Post to Instagram from Codex

Install Hermoso’s plugin and Codex can render and publish to Instagram in a scheduled, non-interactive run.

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

  • post_to_meta: publishes to Instagram with target: "instagram". Instagram is a visual channel and the API agrees: a post needs an image or a video.
  • schedule_post: queues it on the shared calendar, with a per-channel caption if the copy should differ from your Facebook or LinkedIn version.
  • list_meta_comments / reply_to_meta_comment / moderate_meta_comment: read, reply and moderate under a post.
  • meta_page_insights / meta_post_insights: reach, impressions, saves and engagement, per account and per post.
  • search_instagram: keyword search across public Instagram Reels, for research rather than publishing.

Two Instagram facts worth knowing before you automate anything. There is no native Instagram scheduling in Meta’s API, so a schedule is Hermoso’s queue rather than Instagram’s, and passing Facebook’s scheduleAt for Instagram is refused rather than silently posted now. And an Instagram caption cannot be edited once the post is live: the only thing Meta lets you change on a published post is whether comments are enabled. Deleting one is supported: manage_meta_post removes ordinary posts, Stories, Reels and entire carousel albums, though never a single card out of an album.

Instagram limits worth knowing before you automate anything

TextAn Instagram caption is capped at 2,200 characters. 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 only. Meta’s Content Publishing API publishes immediately or not at all, and Instagram “has no unlisted, private or draft post.” If you want a review step on Instagram, it has to happen before the call, not after.
Carousel2 to 10 slides, and images and video may be mixed. That upper bound is Meta’s own, quoted in the capability table it enforces: “Carousels are limited to 10 images, videos, or a mix of the two.” The floor of 2 is ours, because one slide is not a carousel on any platform. A single-slide ask publishes as an ordinary post rather than being refused.
Which accountpageId. Instagram publishes through the connected Facebook Page, so the same identity field selects it.

Try it in Codex

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

“Non-interactive: build a 4-slide carousel from today's product photos, publish it to Instagram with a caption under 2,200 characters, and exit with the permalink.”

That walks search_instagram → plan_ad → render_ad → post_to_meta (target: "instagram"). 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 Instagram: the part that bites

Instagram needs one human step in an unattended pipeline: a published caption can never be edited through the API. If Codex is running on a timer, put the review before the publish: generate and hold, then publish on approval. Deleting is the only undo. manage_meta_post removes ordinary posts, Stories, Reels and whole carousel albums, but a delete takes the likes and comments with it.

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

search_meta_ads covers Instagram placements as well as Facebook, since it is one library. For organic, search_instagram searches public Reels by keyword, which is the surface where the format actually moves; profile and hashtag pulls go through fetch_social_data and search_instagram_hashtag.

The paid half

Instagram placements are bought through the same Meta campaign tree as Facebook: create_meta_campaign → create_meta_adset → create_meta_ad, with placements selectable per platform and position. preview_meta_ad shows the real rendered ad per placement before you spend, and meta_insights breaks results down by age, gender, placement and country. That breakdown is what shapes the next creative.

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

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

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

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

Can Codex post a carousel to Instagram?

Yes, 2 to 10 slides, and images and video can be mixed. Ten is Meta’s own published limit, not one Hermoso invented. Codex calls the same publish tool either way, and a channel that cannot carry a carousel is refused with the real reason attached.

What does it cost to post to Instagram from Codex?

Publishing to Instagram costs no credits; Meta charges nothing per API call. Credits go on the render itself. 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.

Does Codex need my Instagram password?

No. You connect Instagram 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.

Can Codex schedule a Instagram 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. Instagram 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