Post to TikTok from Codex

An unattended Codex run cannot tap “publish” in the TikTok app, which makes the drafts limit the single most important thing to design around here.

Hermoso is a marketing MCP server: 301 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 is about one slice of that — what Codex can actually do on TikTok, and what TikTok will not let it do.

Connect Hermoso to Codex

  1. Create an API key. In Hermoso, open Settings → Agents & API keys and press + Create API key. It looks like hmk_… and carries real spend authority, so treat it like a password.
  2. Add it to ~/.codex/config.toml. Codex reads TOML, not JSON — a copied mcpServers block will not load:
    [mcp_servers.hermoso]
    url = "https://app.hermoso.ai/mcp"
    http_headers = { "Authorization" = "Bearer <your key>" }
  3. 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.

The TOML detail is the one that trips people up: every other client in this list takes a JSON mcpServers object, and Codex takes [mcp_servers.<name>] with http_headers.

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 — uploads a finished video, or a photo post of up to 35 images, either straight to the profile or into your TikTok drafts. 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.
  • tiktok_account / tiktok_creator_info — the account’s bio, verification, follower and video counts, and what privacy levels the account itself allows.
  • list_tiktok_videos — recent posts with views, likes, comments and shares.
  • search_tiktok — keyword search across public TikTok — 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 there are no TikTok comment or moderation tools here — publishing and reading are covered, replying is not.

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 — refused while you are still there to fix it, rather than silently cut on the way out.
VisibilityThis is the one to read before you plan anything. TikTok’s content-sharing guidelines restrict an unaudited app to self-only posts, TikTok enforces it at post time, and Hermoso refuses up front rather than failing hours later: “until the app passes TikTok’s review, their content-sharing guidelines restrict it to SELF_ONLY (private-to-you) posts. Two things that DO work right now: post with privacy SELF_ONLY, or send it to TikTok drafts (destination 'draft') and publish it yourself in the app.” Hermoso has not passed TikTok’s review yet, so that is today’s behaviour — and the scheduler removes public from TikTok’s options at enqueue rather than accepting a schedule that is guaranteed to fail.
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 sentences, not a DSL:

“Non-interactive: render three hook variations, upload each to TikTok drafts with its caption and cover frame, and print the draft ids as JSON.”

That walks search_tiktokplan_adrender_adpost_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 audit state matters most. Hermoso is unaudited, so TikTok accepts only self-only posts from it, and an unattended pipeline has nobody to finish a draft in the app. Two workable shapes: publish self-only, which really is private to you, or upload to drafts and treat the human tap as the last step of the job rather than pretending it does not exist.

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

There is no TikTok ad library to search the way Meta’s can be searched, 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

Hermoso does not manage TikTok ad campaigns, and says so rather than implying it. TikTok Ads is a separate connector that has not been built. What Hermoso does on TikTok is organic: make the video, post or draft it, read the account back.

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 — and 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 — or see everything Codex can publish to.

Post to TikTok from: Claude · ChatGPT · Claude Code · Cursor · Cline · OpenClaw · Hermes · Ads from the command line

Frequently asked questions

Can Codex post to TikTok?

Yes, through Hermoso's MCP server. Create an API key in Hermoso under Settings → Agents & API keys, then add https://app.hermoso.ai/mcp to Codex with an Authorization: Bearer header. Codex then has 301 tools, including the ones that publish to TikTok — and 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. Create an API key in Hermoso under Settings → Agents & API keys, then add https://app.hermoso.ai/mcp to Codex with an Authorization: Bearer header. 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 $19, $49 and $149 a month for 1,000, 3,000 and 10,000 credits, and every feature is on every plan including Free — the only exception is enterprise SSO.

Start free — 25 credits at signup and 250+ more to earn, and every feature on every plan.

Start free   See pricing