Run Codex sessions from Grok Bot with your own ChatGPT subscription

Let Grok Bot start and follow Codex sessions on your own computer through Happier, using your own ChatGPT plan or OpenAI API key.

Based on
CLI
0.2.17
Preview ref
a6f72a6

TL;DR

Grok Bot can start Codex sessions on your own computer through Happier. Install Codex on that computer and sign it in with your ChatGPT plan with Codex or an API key. Connect Grok Bot to Happier with the public Happier template, which runs happier mcp serve. Grok Bot can then call the session_spawn_new tool to start a Codex session on a machine and folder you choose. The session runs the Codex CLI installed on that machine, with that machine's login, so the usage counts against your own Codex plan or key.

The problem

An AI assistant is handy for deciding what to work on next. Turning that into actual coding work usually means switching tools: open a terminal, start Codex, paste the plan, then come back later to see what happened.

If you already pay for ChatGPT plan with Codex, you probably want that plan to do the coding work, on your own machine and your own repo, while the assistant handles the planning and the follow-up.

Common approaches and their trade-offs

  • Copy the plan into a terminal: simple, but every step is manual and the assistant loses track of what happened.
  • Give the assistant SSH access: it can start Codex itself, but it also gets a full shell on your machine.
  • Let the assistant write the code itself: fine for small changes, but the work does not happen in your local repo with your own Codex setup.
  • Happier: Happier is an open-source app that lets you run and orchestrate Claude Code, Codex and other agents cross-device, from your phone, desktop or the web. An assistant connected to Happier through MCP can start and follow sessions, and each session uses the agent CLI and login on your machine.

If you're new to Happier (what it is, and where to get it)

Happier is an open-source app that lets you run and orchestrate Claude Code, Codex, OpenCode and other agents cross-device, from your phone, desktop or the web. Gemini, Copilot, Cursor, Kiro and more agents are listed in the agent docs.

The workflow here is: Grok Bot asks Happier to start a Codex session, and the session runs on the machine that owns the repo, with your own Codex login.

Get set up:

Who this is for

  • Codex users with ChatGPT plan with Codex who want an assistant to kick off and follow coding work
  • People who keep repos on a desktop, laptop or home server and want the work to stay there
  • Teams on Happier Cloud or a self-hosted relay

Prerequisites

  • A computer with your repo, the Happier CLI and the Happier daemon running
  • Codex installed on that computer and signed in
  • A Happier account, and the Happier app to approve sign-in links
  • Grok Bot set up from the Happier template, or another MCP host that can run happier mcp serve

A workflow that works (step-by-step)

1) Install Codex on the machine that owns the repo

Happier does not ship its own copy of the model. It runs the Codex CLI that is installed on the machine. Happier can install it for you:

happier install provider codex

Or use npm install -g @openai/codex, then restart Happier.

2) Sign Codex in with your own plan

You have two options, both documented in the Codex docs:

  • Machine-local login: run codex login on the machine, or open Settings → AI & Agents → AI backends → Codex in Happier and use Log in. Happier then shows whether it detected a CLI login or OPENAI_API_KEY.
  • Connected services: store credentials in Happier with happier connect codex --device (or Settings → Connected services). This supports both a subscription and an API key, and lets you pick a profile when a session starts.

Either way, the session uses your login. The usage goes to your Codex plan or key, not to Happier.

3) Make sure the daemon is running

Sessions started remotely are spawned by the Happier daemon on the target machine:

happier daemon status
happier daemon start

For a machine that should always be reachable, happier daemon install sets it up as a service.

4) Connect Grok Bot to Happier

The Happier Grok Bot template installs the Happier CLI on Grok Bot's own computer and pairs it with your account. You approve the one-time link in the Happier app. Works with Happier Cloud or a self-hosted relay. Tailscale is optional for private relays. The template then talks to Happier through happier mcp serve. The full setup is in Manage AI coding sessions from an AI assistant with Happier.

5) Ask Grok Bot to start a session

Happier exposes the session_spawn_new tool over MCP. It takes, among other fields, agentId, machineId, path, modelId, permissionMode, connectedServices and initialMessage. A request like this is enough:

Start a Codex session on my desktop in ~/code/my-app and ask it to fix the failing tests in the billing module.

Grok Bot picks the machine and folder (it can look them up with action_options_resolve), starts the session, and sends the first message. Starting a session can need an approval in Happier, depending on your settings.

You can also start the session yourself from the Happier app, or with happier codex on the machine, and let Grok Bot follow it.

6) Follow up

Grok Bot can then use session_status_get, session_wait_idle and session_message_send to check progress and send follow-ups. Permission prompts raised by Codex come back to you. The template asks for your yes on each one.

Why this works (and what breaks)

The session is a normal Happier session. The daemon spawns the Codex CLI on your machine, in your repo, with that machine's login or the connected service you picked. Grok Bot only calls Happier actions, the same ones the app and CLI use.

What to keep in mind:

  • Monitoring is polling. Happier does not push session events to an MCP host yet (issue #795). The template's watcher checks status every 5, 15 or 30 minutes (5 to 15 is recommended), so updates arrive at that interval. It stays silent unless there is a new permission request, a finished turn or an error.
  • The machine has to be online. If the daemon is not running, Happier cannot start the session.

Common mistakes

  • Codex not signed in on the target machine → the session starts and then fails to authenticate → check AI backends → Codex → Authentication for that machine.
  • Wrong machine or path → the session starts in the wrong repo → name the machine and folder in the request, or let Grok Bot list the options first.
  • Daemon not running → the spawn fails → run happier daemon start, or install it as a service.
  • Expecting instant updates → monitoring is polling → keep Happier app notifications on for urgent prompts.

Troubleshooting

Symptom: the session starts but Codex reports it is not logged in

Likely cause:

  • No CLI login and no connected service on that machine.

Fix:

  1. Open Settings → AI & Agents → AI backends → Codex, pick the machine, and use Log in.
  2. Or run happier connect codex --device and select that profile when starting the session.

Symptom: Grok Bot cannot find your machine

Likely cause:

  • The daemon is not running, or the machine is on a different Happier server than Grok Bot.

Fix:

  1. Run happier daemon status on the machine.
  2. Make sure both are signed in to the same server and account.

Symptom: not_authenticated from the Happier tools

Likely cause:

  • The Happier CLI on Grok Bot's side is not paired.

Fix:

  1. Redo the pairing step from the template and approve the link in the app.

FAQ

Whose Codex plan does the session use?

Yours. The session runs the Codex CLI on your machine with the login or connected service you set up.

Can Grok Bot start sessions, or only watch them?

It can start them through session_spawn_new, if you let it. The template also has watch only and assist modes if you prefer to start sessions yourself.

Does this work with other agents?

Yes. The same tool takes an agentId, so the flow works for any agent Happier supports on that machine, such as Claude Code, Codex or OpenCode.

codexmcpassistantsubscriptions
Last updated: 2026-10-30