Post to Instagram from Gemini CLI

From Gemini CLI, Instagram is a render and a caption checked before the call, because the caption is the one thing you cannot change afterwards.

Hermoso is a marketing MCP server: 850+ 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. Gemini CLI reaches all of it through one connection. This page is about one slice of that — what Gemini CLI can actually do on Instagram, and what Instagram will not let it do.

Connect Hermoso to Gemini CLI

  1. Install the extension.
    gemini extensions install https://github.com/hermoso-ai/hermoso
    It installs the latest release of Hermoso’s public repository: five skills (research, ad-from-brand, generate, product-photoshoot and marketing) plus a GEMINI.md context file. The skills run the hermoso command through npx, so nothing is added to Gemini CLI’s tool list and nothing costs context until a command runs. gemini extensions list shows them under Agent skills.
  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. Gemini CLI can run it for you the first time it needs Hermoso. No browser on that machine? Create a key under MCP & CLI → Terminal & API keys and run npx -y hermoso auth login --token hmk_….
  3. Optional: the MCP server as well.
    gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp
    Gemini CLI finds Hermoso’s authorization server when the first connection answers 401 and registers itself, so no key goes in settings.json; /mcp auth hermoso inside a session runs the sign-in. The skills reach every tool without it.
  4. Ask Gemini CLI 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.

We ran the install above on 2026-09-23 against Gemini CLI 0.60.0 in a clean home directory: it pulled the current release of hermoso-ai/hermoso, and gemini extensions list reported the five skills and the context file. The extension carries no MCP server of its own, which is deliberate: a tool list is loaded into every session, and skills cost nothing until they run. Hermoso is not affiliated with or endorsed by Google.

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 Gemini CLI 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 — research, not 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 — refused while you are still there to fix it, rather than silently cut on the way out.
VisibilityPublic only. Meta’s Content Publishing API publishes, full stop — “Instagram publishes immediately when it publishes at all — it 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 Gemini CLI

Ask for it in ordinary language — these are sentences, not a DSL:

“Build a 6-slide Instagram carousel from ./assets/slides in filename order, show me the caption, and post it after I say yes.”

That walks search_instagramplan_adrender_adpost_to_meta (target: "instagram"). Gemini CLI asks before it runs a shell command, and the skills act through the hermoso command, so a publish shows up as a line you can read before you say yes. For MCP tools it offers once, always for that tool, or always for the server.

Gemini CLI on Instagram: the part that bites

Gemini CLI asks before it runs a shell command, and the skills reach Hermoso through the hermoso command, so that prompt is where the caption review happens. Meta allows no edit to a live Instagram caption, only whether comments are on. Deleting is supported with manage_meta_post, whole albums included, never a single card out of one.

Two Gemini CLI details decide how safe this is. gemini mcp add writes to the project’s .gemini/settings.json unless you pass --scope user, which is useful when one repo should always run against one brand. And never add Hermoso with --trust: it skips every confirmation for the server, including the ones in front of a publish. MCP tools arrive named mcp_hermoso_ plus the tool name, and --exclude-tools keeps any of them out entirely.

Research Instagram before you post

search_meta_ads covers Instagram placements as well as Facebook — 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_campaigncreate_meta_adsetcreate_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 — which is the input to the next creative, not just a total.

What Gemini CLI 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 Gemini CLI, post to: Facebook · Threads · TikTok · YouTube · X · LinkedIn · Pinterest · Bluesky · Telegram — or see everything Gemini CLI can publish to.

Post to Instagram from: Claude · ChatGPT · Claude Code · Cursor · Codex · Cline · OpenClaw · Grok Bot · Hermes · Perplexity · Le Chat

Frequently asked questions

Can Gemini CLI post to Instagram?

Yes, with Hermoso's Gemini CLI extension. Run gemini extensions install https://github.com/hermoso-ai/hermoso, which adds five Hermoso skills that drive the hermoso command, 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. If you also want Hermoso's tools in Gemini CLI's own list, gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp adds the hosted server, which signs in with OAuth. Gemini CLI then has 850+ tools, including the ones that publish to Instagram — and 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 Gemini CLI?

Two steps, once each. Run gemini extensions install https://github.com/hermoso-ai/hermoso, which adds five Hermoso skills that drive the hermoso command, 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. If you also want Hermoso's tools in Gemini CLI's own list, gemini mcp add --scope user --transport http hermoso https://app.hermoso.ai/mcp adds the hosted server, which signs in with OAuth. Then connect Instagram inside Hermoso under Settings → Connectors, which is an OAuth consent screen in a browser. After that Gemini CLI publishes to Instagram as an ordinary tool call.

Can Gemini CLI post privately or as a draft to Instagram?

No. Instagram’s Content Publishing API publishes or does nothing — there is no unlisted, private or draft post. A published caption also cannot be edited; the only field Meta lets you change on a live post is whether comments are enabled. Deleting a post is supported, and covers ordinary posts, Stories, Reels and entire carousel albums. Hermoso refuses a visibility Instagram cannot honour at the moment you ask for it, rather than quietly publishing something weaker.

Can Gemini CLI research Instagram before it posts?

Yes. search_meta_ads covers Instagram placements in the Meta Ad Library, and search_instagram searches public Reels by keyword.

Start free — 30 credits at signup and 250+ more to earn, and every feature 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