Post to YouTube from Codex

A scheduled Codex run is a natural fit for batch uploads, as long as the title, description and tags are passed explicitly, because a caption alone becomes a 100-character title.

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 YouTube, and what YouTube 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 YouTube 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 YouTube tools Codex gets

  • post_to_youtube: uploads a finished video with a title, a description of up to 5,000 characters, up to 30 tags, and a privacy setting.
  • schedule_post: queues the upload, and carries the description and tags through with it.
  • set_youtube_thumbnail: puts a designed thumbnail on the upload. It is the single biggest lever on click-through, and YouTube otherwise picks a frame more or less at random.
  • make_thumbnail: generates that thumbnail in the first place.
  • update_youtube_video / list_youtube_videos: edit an upload’s metadata, or list your own uploads, including unlisted and private ones a public search cannot see.
  • youtube_video_insights / youtube_channel: views, watch time, average view percentage and subscribers gained.
  • list_youtube_comments / reply_to_youtube_comment: read and answer comments as the channel.

The unit really is a video: post_to_youtube takes a videoUrl and there is no image path at all. Two smaller gates worth knowing before an automated upload: a Google project that has not been verified has videos.insert locked to private regardless of what you ask for, and custom thumbnails need a phone-verified channel.

YouTube limits worth knowing before you automate anything

TextA YouTube title is capped at 100 characters, and a scheduled item’s text becomes the title. The description is a separate field of up to 5,000 characters, carrying up to 30 tags. 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.
VisibilityPublic, unlisted or private. There is no Studio draft: “YouTube’s API can upload as public, unlisted or private, but it cannot create a Studio draft”, so unlisted is the closest thing to a review state, and it is what an immediate post defaults to so an ad-ready upload is not accidentally public.
CarouselRefused, by name. “YouTube’s unit is a video, not a set of stills. Turn the slides into a video (Hermoso can stitch them) and post that instead, or drop YouTube from this post.” Hermoso did not invent that limit to avoid work; it is simply what YouTube is. The refusal comes at enqueue, with the way forward attached, instead of a silently posted first slide.
Which accountNone. YouTube publishes to the connected channel.

Try it in Codex

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

“Non-interactive: for every mp4 in the input directory, write a title under 100 characters and a 5,000-character description, generate a thumbnail, upload unlisted, print JSON.”

That walks make_thumbnail → post_to_youtube → set_youtube_thumbnail → youtube_video_insights. 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 YouTube: the part that bites

Upload unlisted from an unattended run, always. YouTube has no Studio draft, unlisted is the review state, and a batch that goes straight to public is a batch you cannot un-publish quietly. Also check the channel first: an unverified Google project has uploads locked to private whatever privacy the job requests, which will look like a bug and is not one.

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 YouTube before you post

search_youtube searches the public YouTube index. That is a different question from “what have I uploaded”, and list_youtube_videos is the tool for that one. For a competitor’s film, analyze_video returns the voiceover, the on-screen text and the beat list with timestamps, which is what you actually want before rebuilding a hook.

The paid half

Hermoso’s Google Ads tools build search, display and Performance Max campaigns (the whole tree in one atomic operation, read back from Google before your agent narrates it), plus Keyword Planner volumes, conversion actions, and sitelinks and callouts created and attached. There is no YouTube video-campaign builder, and it would be wrong to imply one; a YouTube video asset can be uploaded and attached, but the campaign types Hermoso creates are search, display and Performance Max.

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 · TikTok · X · LinkedIn · Pinterest · Bluesky · Telegram. Or see everything Codex can publish to.

Post to YouTube 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 YouTube?

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 YouTube, plus the ones that research the ads already running in your market and render the creative in the first place.

How do I connect YouTube 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 YouTube inside Hermoso under Settings → Connectors, which is an OAuth consent screen in a browser. After that Codex publishes to YouTube as an ordinary tool call.

What is the YouTube caption limit when posting from Codex?

A YouTube title is capped at 100 characters. The description is a separate field of up to 5,000 characters, with up to 30 tags. A scheduled item’s text becomes the title, so both must be passed explicitly. Hermoso enforces it when the post is created or queued, so Codex is told immediately rather than failing later when nobody is watching.

Can Codex schedule a YouTube 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. YouTube is one of the eleven channels that queue.

Can Codex post privately or as a draft to YouTube?

Yes: public, unlisted or private. There is no Studio draft in YouTube’s API, so unlisted is the review state, and an immediate post defaults to it. Hermoso refuses a visibility YouTube cannot honour at the moment you ask for it, rather than quietly publishing something weaker.

What does it cost to post to YouTube from Codex?

Publishing to YouTube costs no credits; YouTube charges nothing per API call. Credits are spent generating the video and the thumbnail. 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.

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