Recipes / Dev & code
Grok BotFull setupDev & code

Wire Claude Code and Codex CLIs into Grok Bot

Install the Claude Code and Codex CLIs on the bot's computer, sign in once, then route writing to Claude and coding to Codex from every bot.

Setup time15 min
CostYour Claude + ChatGPT/Codex plans
RunsOnce
NeedsGrok Bot computer, Claude Code CLI, Codex CLI
Last updated2026-10-16
XSource

Connect your ChatGPT and Claude subscriptions to Grok Bot with the prompt below

by Corey Ganim (@coreyganim) · 2026-10-14

✓ Opened via the X API on 2026-10-16

Read the original ↗
Part 1 · What the source did

Install the Claude Code and Codex CLIs on the bot's computer, sign in once, then route writing to Claude and coding to Codex from every bot.

  • Pasted a setup prompt so Grok Bot installed the Claude Code and Codex CLIs on its own computer.
  • Signed into each CLI once (device/auth flow), then saved model routing into every bot prompt plus shared memory.
  • Writing tasks go through Claude; coding and terminal work go through Codex; browser/desktop stays on the bot's normal tools.
“Your Grok Bot is calling Codex/Claude Code via the CLI”— Corey Ganim (@coreyganim), X

Summary written by Agent Cookbook. See the original for the full context.

Part 2 · Our copy-paste version

Adapted by us from what the source described. Fill in the [BRACKETS].

The prompt

Connect my Claude and ChatGPT subscriptions so all of my bots can use them. 1. On your computer, install the Claude Code CLI and the OpenAI Codex CLI (upgrade Node if needed). Start each subscription login (Claude: `claude setup-token`; Codex: `codex login --device-auth`) and send me the sign-in links and codes. I'll sign in and paste back anything you need. Store the Claude token privately and load it automatically. 2. Set the defaults to these models: [CLAUDE_MODEL] for Claude Code and [CODEX_MODEL] for Codex. Test each one with a quick prompt and tell me which models answered. 3. Add these MODEL ROUTING RULES to every one of my bots' system prompts, including yours. Keep everything else in each prompt exactly as it is: - Writing (drafts, emails, posts, replies, copy, briefs): write the final text with Claude through the CLI, then review it against the bot's voice rules. - Coding, scripts, data processing, and terminal work: use Codex. - Browser and desktop tasks: keep using your normal computer tools. - If either CLI fails, do the task yourself and say so. 4. Save the same rule to my shared memory so any bot I create later follows it too. 5. When you're done, tell me which bots you updated and confirm both tests passed. Never send, buy, post, or delete without my explicit yes for that action.
🛡
Approval ruleYou complete each CLI sign-in yourself. Sending, buying, posting, and deleting still need a human yes.

Set it up

  1. Paste the prompt into the bot that owns the computer (or your Chief of Staff bot).
  2. When it returns sign-in links or codes, complete Claude and Codex login yourself in a browser.
  3. Confirm the two smoke tests and that routing rules landed in shared memory.

Common failures

⚠
What usually goes wrong
  • Login stalls because you skipped the device/auth step; the bot cannot finish OAuth alone.
  • Routing never sticks if you only edit one bot; put the rules in shared memory too.

Variations

  • Swap which model handles writing vs coding.
  • Limit CLI use to one specialist bot instead of every bot.

Related recipes