Post to TikTok from Codex

A non-interactive Codex run can post to TikTok, provided the privacy is in the request, because TikTok will not accept a default.

Hermoso is a marketing MCP server: 922+ tools over one OAuth’d endpoint that let an agent research the ads already running in a market, generate finished image and video ads, publish them, and build the paid campaigns behind them. Codex reaches all of it through one connection. This page covers one slice of that: what Codex can actually do on TikTok, and what TikTok will not let it do.

Connect Hermoso to Codex

  1. One command, and no key.
    codex plugin marketplace add hermoso-ai/hermoso && codex plugin add hermoso@hermoso
    Codex reads the marketplace file in Hermoso’s public repository and installs its five skills (research, ad-from-brand, generate, product-photoshoot and marketing). The skills run the hermoso command through npx, so no tool list is loaded into your sessions and nothing costs context until a command runs.
  2. Sign in once.
    npx -y hermoso auth login
    It opens a browser sign-in and stores an owner-only credential in ~/.hermoso/config.json. No browser on that machine, say CI or a container? Create a key under MCP & CLI → Terminal & API keys and run npx -y hermoso auth login --token hmk_…. A key carries real spend authority, so treat it like a password.
  3. Optional: the MCP server as well.
    codex mcp add hermoso -- npx -y hermoso mcp
    That writes the server into ~/.codex/config.toml and reads the same stored credential, so no key goes in the file. Prefer the hosted endpoint? codex mcp add hermoso --url https://app.hermoso.ai/mcp, then codex mcp login hermoso for the OAuth sign-in. The skills reach every tool without either.
  4. Ask Codex for something. “Pull my three closest competitors’ longest-running ads and remix the best hook into a 9:16 video,” or “post this render to the channel.” The agent picks the tools; you approve the spend.

Codex keeps MCP servers in ~/.codex/config.toml, or .codex/config.toml in a trusted project, and that file is TOML, not JSON: a copied mcpServers block will not load, and a hand-written entry is [mcp_servers.hermoso] with command = "npx" and args = ["-y", "hermoso", "mcp"]. The trailing mcp is load-bearing: npx -y hermoso with no subcommand prints help and exits. Codex reads plugin marketplaces in the same .claude-plugin layout Claude Code uses, which is why one repository installs in both.

Then connect TikTok itself, once, under Settings → Connectors in Hermoso. That is an OAuth consent screen, so it is the one step that needs a browser. Everything after it is a tool call.

The TikTok tools Codex gets

  • post_to_tiktok: publishes a finished video, or a photo post of up to 35 images, live on the profile at the privacy you choose, or into your TikTok drafts to finish in the app. It also carries the interaction settings (comments, duet, stitch), the cover frame and the branded-content disclosure.
  • schedule_post: queues it for later on the shared calendar, with the privacy fixed when you queue it.
  • tiktok_account / tiktok_creator_info: the account’s bio, verification, follower and video counts, and the privacy levels the account itself allows.
  • tiktok_post_status: follows a post TikTok is still processing, so a slow upload is checked rather than posted twice.
  • list_tiktok_videos / tiktok_account_insights: recent posts with views, likes, comments and shares, and the account’s own analytics, with follower demographics on a Business account of 100 or more followers.
  • list_tiktok_comments / reply_to_tiktok_comment / moderate_tiktok_comment: reads the comments on your posts, replies as the account, and likes, hides or deletes, once the TikTok account authorization is connected.
  • search_tiktok: keyword search across public TikTok, which is the research half.

Two more operational facts. TikTok photo posts are pulled from a URL rather than uploaded, so the host serving the images has to be verified in TikTok’s developer portal before photo posts can go out at all. And a draft carries no cover frame: on a direct post Hermoso sets the video’s best frame as the cover, while for a draft you pick the cover in the TikTok app.

TikTok limits worth knowing before you automate anything

TextA TikTok video caption is capped at 2,200 characters, a photo-post caption at 4,000, and a photo title at 90. It is enforced when the post is created or queued, so an overlong post is refused while you are still there to fix it instead of being silently cut on the way out.
VisibilityEveryone, followers, friends, only you, or a draft, and you choose. Hermoso passed TikTok’s Direct Post audit in August 2026, so a post can go live on the profile. TikTok’s rule is that the creator picks the privacy for every post, with nothing pre-selected, and only from the levels tiktok_creator_info says the account allows, so Hermoso asks instead of defaulting and refuses a post that names none before anything uploads. A draft goes to the TikTok inbox for you to finish in the app, which is also where you add a TikTok sound. There is no unlisted. Branded content cannot be combined with a private (only you) post, and that combination is refused rather than resolved for you.
CarouselUp to 35 images as a TikTok photo post, images only. That number is TikTok’s: “An array containing up to 35 photo content URLs.” The order is the slideshow, so slide order is the product. One image is simply a one-slide post, not a refusal.
Which accountNone. TikTok publishes to the connected account.

Try it in Codex

Ask for it in ordinary language. These are plain sentences, not a DSL:

“Non-interactive: render three hook variations, post the first to everyone, send the other two to TikTok drafts, and print the publish ids as JSON.”

That walks search_tiktok → plan_ad → render_ad → post_to_tiktok. Interactively Codex shows the call before it runs it. Non-interactively there is nobody to ask, which is worth designing around on any step that publishes or spends.

Codex on TikTok: the part that bites

This is the pair where TikTok’s rules matter most. The privacy has to be stated, never defaulted, so put it in the prompt or the job is refused before an upload. And a slow upload comes back pending rather than done: have the run poll tiktok_post_status with the publish id, because posting again while TikTok is still processing would publish the video twice.

For unattended runs, prefer the hermoso CLI with --json over the full tool manifest. It is far cheaper in context and easier to assert on.

Research TikTok before you post

Hermoso has no TikTok ad-library search of the kind it runs on Meta, so TikTok research is organic: search_tiktok finds what is working by keyword, and analyze_video will pull a clip apart into its hook, beats and on-screen text so the pattern can be reused rather than guessed at.

The paid half

TikTok Ads is one of the twelve paid platforms Hermoso builds and reads campaigns on, including Smart+ campaigns and Spark Ads that promote an organic post, and it is a separate connection from the organic one. Campaigns run on TikTok’s Marketing API and posting runs on its content-posting approval, so Hermoso reports each one on its own rather than letting one imply the other. Only a confirm-gated status switch arms real money.

What Codex cannot do on its own

An agent with a budget is only useful if the blast radius is bounded, so the fence is in the server rather than in a prompt. Every ad campaign, ad set, ad group and ad is created paused, and the status switches that arm real money refuse to run without an explicit confirmation flag. Every render is quoted first (hermoso_capabilities publishes each model’s exact credit cost before anything spends). Credits are reserved before the first provider call and settled at the exact cost afterwards, so a failed dispatch refunds rather than leaving you billed for nothing. Deletes are confirm-gated too, and every campaign tree is read back from the ad platform before your agent tells you what it built.

One step is deliberately not headless: linking an account is an OAuth consent screen, so you connect the channel once in a browser. Everything after that is a tool call.

The rest of the matrix

From Codex, post to: Facebook · Instagram · Threads · YouTube · X · LinkedIn · Pinterest · Bluesky · Telegram. Or see everything Codex can publish to.

Post to TikTok from: Claude · ChatGPT · Claude Code · Cursor · Cline · OpenClaw · Grok Bot · Hermes · Gemini CLI · Perplexity · Le Chat · Claude Cowork · Perplexity Computer · Paperclip · Ads from the command line

Frequently asked questions

Can Codex post to TikTok?

Yes, with Hermoso's Codex plugin. Run codex plugin marketplace add hermoso-ai/hermoso && codex plugin add hermoso@hermoso, which installs Hermoso's skills, then sign in once with npx -y hermoso auth login. The sign-in opens a browser and stores the credential itself, so there is no key to create and none to paste. For the MCP server as well, run codex mcp add hermoso -- npx -y hermoso mcp. Codex then has 922+ tools, including the ones that publish to TikTok, plus the ones that research the ads already running in your market and render the creative in the first place.

How do I connect TikTok to Codex?

Two steps, once each. Run codex plugin marketplace add hermoso-ai/hermoso && codex plugin add hermoso@hermoso, which installs Hermoso's skills, then sign in once with npx -y hermoso auth login. The sign-in opens a browser and stores the credential itself, so there is no key to create and none to paste. For the MCP server as well, run codex mcp add hermoso -- npx -y hermoso mcp. Then connect TikTok inside Hermoso under Settings → Connectors, which is an OAuth consent screen in a browser. After that Codex publishes to TikTok as an ordinary tool call.

Does Codex need my TikTok password?

No. You connect TikTok to Hermoso once through an OAuth consent screen in a browser, and Codex then reaches it as a tool call. Linking an account is the one step that is not headless; nothing after it needs a password, and no credential is ever handed to the model.

What does it cost to post to TikTok from Codex?

Publishing to TikTok costs no credits; TikTok charges nothing per API call. Credits are spent on the render. Plans are $29, $69 and $149 a month for 1,200, 3,000 and 7,000 credits, and every feature is on every plan including Free. The only exception is enterprise SSO.

Can Codex post a carousel to TikTok?

Yes. A TikTok photo post takes up to 35 images, in the order you pass them, and the order is the slideshow. Video cannot be mixed in. Codex calls the same publish tool either way, and a channel that cannot carry a carousel is refused with the real reason attached.

Can Codex schedule a TikTok post for later?

Yes. schedule_post queues it on one calendar shared with every other channel, with a per-channel caption if the copy should differ, and list_scheduled and cancel_scheduled read and pull it back. TikTok is one of the eleven channels that queue.

Start free with 30 credits at signup and 250+ more to earn. Every feature is on every plan. Credits are spent only on AI models and Ad Spy research; posting, scheduling, ads management and analytics are free.

Start free →   See pricing