Use Codex CLI by OpenAI as the AI runner — runs codex exec —json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.
Codex CLI is OpenAI’s terminal coding agent, built in Rust. The codex runner invokes codex exec --json --full-auto as a subprocess and parses its structured JSONL output to stream responses to Telegram in real time.
A ChatGPT Plus, Pro, Business, Edu, or Enterprise subscription or a CODEX_API_KEY (OpenAI API key)
Install Codex CLI:
npm install -g @openai/codex
Verify the installation:
codex --version
Authentication
Codex CLI supports two authentication modes:
Option A — API key
Set a CODEX_API_KEY (your OpenAI API key) during remoteagent init. RemoteAgent.CHAT injects it at runtime — no manual environment variable setup required.
Option B — Device login (no browser on the server needed)
Run codex login --device-auth. Codex displays a short URL and a code. Open that URL on any device — your phone, laptop, or any browser — and enter the code to authenticate your ChatGPT account. No browser is needed on the server where the agent runs.
codex login --device-auth
Credentials are stored in ~/.codex/auth.json and reused automatically on every subsequent run.
Option C — Already authenticated
If you have previously logged in with codex login or codex login --device-auth, you can skip the auth step during remoteagent init — the stored credentials will be used automatically.
Setup
remoteagent init --runner codex
Or choose codex when prompted by the interactive wizard.During remoteagent init, the wizard will ask:
Auth method — API key, device login (codex login --device-auth), or skip if already authenticated
Model — optional; defaults to gpt-5.4. Enter any model ID supported by Codex CLI.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"RemoteAgent.CHAT","colors":{"primary":"#1B84FF","light":"#60AEFF","dark":"#0D5ECC"},"logo":{"light":"https://mintcdn.com/remoteagentchat/px6-PCumF-TyyIWF/logo/light.svg?fit=max\u0026auto=format\u0026n=px6-PCumF-TyyIWF\u0026q=85\u0026s=73d901cf8b03ed547c879ca4b742ae75","dark":"https://mintcdn.com/remoteagentchat/px6-PCumF-TyyIWF/logo/dark.svg?fit=max\u0026auto=format\u0026n=px6-PCumF-TyyIWF\u0026q=85\u0026s=d14b2e8d649edd085e6725a3bf57b7c1"},"favicon":"https://mintlify.s3.us-west-1.amazonaws.com/remoteagentchat/favicon.svg","navbar":{"links":[{"href":"https://remoteagent.chat","label":"remoteagent.chat"}],"primary":{"type":"button","label":"Get started free","href":"https://remoteagent.chat/signup"}},"footer":{"socials":{"github":"https://github.com/ggiacomo/docs"}},"seo":{},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"remoteagent.chat","icon":"house","href":"https://remoteagent.chat"},{"anchor":"Telegram bot","icon":"paper-plane","href":"https://t.me/remoteagent_bot"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"remoteagentchat","hasAudioNarration":false,"actualSubdomain":"remoteagentchat","customDomains":["docs.remoteagent.chat"],"gitSource":{"type":"github","owner":"ggiacomo","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae94a1e2537587934550871:success","clientVersion":"0.0.4227","searchFilterCounts":[{"language":"default","tag":"Documentation","count":23},{"language":"default","tag":"Runners","count":9},{"language":"default","tag":"Using the Bot","count":3},{"language":"default","tag":"Getting Started","count":3},{"language":"default","tag":"Under the Hood","count":3},{"language":"default","tag":"Platform","count":2},{"language":"default","tag":"Reference","count":1},{"language":"default","tag":"Support","count":1},{"language":"default","tag":"Overview","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"runners/codex","slug":"/runners/codex","pageMetadata":{"title":"codex","description":"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.","href":"/runners/codex"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use Codex CLI by OpenAI as the AI runner — runs codex exec —json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,Table}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://developers.openai.com/codex/cli`,children:`Codex CLI`}),` is OpenAI’s terminal coding agent, built in Rust. The `,_jsx(_components.code,{children:`codex`}),` runner invokes `,_jsx(_components.code,{children:`codex exec --json --full-auto`}),` as a subprocess and parses its structured JSONL output to stream responses to Telegram in real time.`]}),`\n`,_jsx(Heading,{level:`2`,id:`requirements`,children:`Requirements`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Codex CLI installed (`,_jsx(_components.code,{children:`npm install -g @openai/codex`}),`)`]}),`\n`,_jsxs(_components.li,{children:[`A ChatGPT Plus, Pro, Business, Edu, or Enterprise subscription `,_jsx(_components.strong,{children:`or`}),` a `,_jsx(_components.code,{children:`CODEX_API_KEY`}),` (OpenAI API key)`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Install Codex CLI:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -g`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @openai/codex`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Verify the installation:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`codex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --version`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`authentication`,children:`Authentication`}),`\n`,_jsx(_components.p,{children:`Codex CLI supports two authentication modes:`}),`\n`,_jsx(Heading,{level:`3`,id:`option-a-—-api-key`,children:`Option A — API key`}),`\n`,_jsxs(_components.p,{children:[`Set a `,_jsx(_components.code,{children:`CODEX_API_KEY`}),` (your OpenAI API key) during `,_jsx(_components.code,{children:`remoteagent init`}),`. RemoteAgent.CHAT injects it at runtime — no manual environment variable setup required.`]}),`\n`,_jsx(Heading,{level:`3`,id:`option-b-—-device-login-no-browser-on-the-server-needed`,children:`Option B — Device login (no browser on the server needed)`}),`\n`,_jsxs(_components.p,{children:[`Run `,_jsx(_components.code,{children:`codex login --device-auth`}),`. Codex displays a short URL and a code. Open that URL on `,_jsx(_components.strong,{children:`any device`}),` — your phone, laptop, or any browser — and enter the code to authenticate your ChatGPT account. No browser is needed on the server where the agent runs.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`codex`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` login`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --device-auth`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Credentials are stored in `,_jsx(_components.code,{children:`~/.codex/auth.json`}),` and reused automatically on every subsequent run.`]}),`\n`,_jsx(Heading,{level:`3`,id:`option-c-—-already-authenticated`,children:`Option C — Already authenticated`}),`\n`,_jsxs(_components.p,{children:[`If you have previously logged in with `,_jsx(_components.code,{children:`codex login`}),` or `,_jsx(_components.code,{children:`codex login --device-auth`}),`, you can skip the auth step during `,_jsx(_components.code,{children:`remoteagent init`}),` — the stored credentials will be used automatically.`]}),`\n`,_jsx(Heading,{level:`2`,id:`setup`,children:`Setup`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`remoteagent`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` init`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --runner`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` codex`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Or choose `,_jsx(_components.code,{children:`codex`}),` when prompted by the interactive wizard.`]}),`\n`,_jsxs(_components.p,{children:[`During `,_jsx(_components.code,{children:`remoteagent init`}),`, the wizard will ask:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Auth method`}),` — API key, device login (`,_jsx(_components.code,{children:`codex login --device-auth`}),`), or skip if already authenticated`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Model`}),` — optional; defaults to `,_jsx(_components.code,{children:`gpt-5.4`}),`. Enter any model ID supported by Codex CLI.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsx(_components.p,{children:`The runner executes:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`codex`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` exec`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --json`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --full-auto`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --skip-git-repo-check`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -m`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` gpt-5.4`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\u003cprompt>\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`--json`}),` — structured JSONL output on stdout for reliable parsing`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`--full-auto`}),` — alias for `,_jsx(_components.code,{children:`--sandbox workspace-write`}),`, allows file writes in the working directory`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`--skip-git-repo-check`}),` — allows running outside of a git repository`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`-m gpt-5.4`}),` — model selection (gpt-5.4 is the current recommended model)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`--`}),` — separator that prevents prompts starting with `,_jsx(_components.code,{children:`-`}),` from being parsed as flags`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`RemoteAgent.CHAT parses the JSONL event stream and forwards text to Telegram as it arrives:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Event`}),_jsx(_components.th,{children:`Action`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`item.completed`}),` with `,_jsx(_components.code,{children:`type=agent_message`})]}),_jsx(_components.td,{children:`Stream text to Telegram`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`item.completed`}),` with `,_jsx(_components.code,{children:`type=command_execution`})]}),_jsx(_components.td,{children:`Log tool use`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`item.completed`}),` with `,_jsx(_components.code,{children:`type=file_change`})]}),_jsx(_components.td,{children:`Log tool use`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`turn.failed`})}),_jsx(_components.td,{children:`Surface error to Telegram`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`error`})}),_jsx(_components.td,{children:`Capture for diagnostics`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`pros-and-cons`,children:`Pros and cons`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Pros`}),_jsx(_components.th,{children:`Cons`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Structured JSONL output — reliable parsing`}),_jsx(_components.td,{children:`Requires ChatGPT Plus/Pro or OpenAI API key`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Device login — no browser on server needed`}),_jsx(_components.td,{children:`Not free (no free tier for Codex CLI)`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Full filesystem access in `,_jsx(_components.code,{children:`--full-auto`}),` mode`]}),_jsx(_components.td,{children:`Requires Codex CLI installed separately`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`GPT-5 models`}),_jsx(_components.td,{children:`—`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`No API key needed with a ChatGPT subscription`}),_jsx(_components.td,{children:`—`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`model-selection`,children:`Model selection`}),`\n`,_jsxs(_components.p,{children:[`The default model is `,_jsx(_components.code,{children:`gpt-5.4`}),`. To use a different model, specify it during `,_jsx(_components.code,{children:`remoteagent init`}),` or update your agent config:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ~/.remoteagent/agents/\u003cagentId>.json`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"codexModel\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-5.4\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`gpt-5.3-codex`}),` is deprecated and causes WebSocket reconnect loops. Use `,_jsx(_components.code,{children:`gpt-5.4`}),` or a newer model.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`updating-codex-cli`,children:`Updating Codex CLI`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -g`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` @openai/codex@latest`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`codex`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --version`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Restart the agent after updating:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`remoteagent`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` start`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"codex","description":"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.","href":"/runners/codex"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Requirements","slug":"requirements","depth":2,"children":[]},{"title":"Authentication","slug":"authentication","depth":2,"children":[{"title":"Option A — API key","slug":"option-a-—-api-key","depth":3,"children":[]},{"title":"Option B — Device login (no browser on the server needed)","slug":"option-b-—-device-login-no-browser-on-the-server-needed","depth":3,"children":[]},{"title":"Option C — Already authenticated","slug":"option-c-—-already-authenticated","depth":3,"children":[]}]},{"title":"Setup","slug":"setup","depth":2,"children":[]},{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"Pros and cons","slug":"pros-and-cons","depth":2,"children":[]},{"title":"Model selection","slug":"model-selection","depth":2,"children":[]},{"title":"Updating Codex CLI","slug":"updating-codex-cli","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"remoteagentchat","siteName":"RemoteAgent.CHAT","title":"codex - RemoteAgent.CHAT","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-04-14T14:01:24.683Z","originalFileLocation":"runners/codex.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\">\u003cmeta data-mint-head name=\"application-name\" content=\"RemoteAgent.CHAT\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"codex - RemoteAgent.CHAT\">\u003cmeta data-mint-head property=\"og:description\" content=\"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"RemoteAgent.CHAT\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.remoteagent.chat/runners/codex\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://remoteagentchat.mintlify.site/_mintlify/api/og/v2?division=Runners\u0026amp;title=codex\u0026amp;description=Use+Codex+CLI+by+OpenAI+as+the+AI+runner+%E2%80%94+runs+codex+exec+--json+non-interactively+with+structured+JSONL+output.+Supports+API+key+auth+or+device+login+with+no+\u0026amp;theme=bfb3e23b8019de3f9df06c5e\u0026amp;signature=9012ef5521ccf792ff0dbf8dcf0685e2be70189ff2ab78d6037802592cba833c\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"codex - RemoteAgent.CHAT\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://remoteagentchat.mintlify.site/_mintlify/api/og/v2?division=Runners\u0026amp;title=codex\u0026amp;description=Use+Codex+CLI+by+OpenAI+as+the+AI+runner+%E2%80%94+runs+codex+exec+--json+non-interactively+with+structured+JSONL+output.+Supports+API+key+auth+or+device+login+with+no+\u0026amp;theme=bfb3e23b8019de3f9df06c5e\u0026amp;signature=9012ef5521ccf792ff0dbf8dcf0685e2be70189ff2ab78d6037802592cba833c\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/remoteagentchat/rKg0QyTCj8CadLFa/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"RemoteAgent.CHAT\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1B84FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.remoteagent.chat/runners/codex\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/runners/codex.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.remoteagent.chat/#organization\",\"name\":\"RemoteAgent.CHAT\",\"url\":\"https://docs.remoteagent.chat\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/remoteagentchat/px6-PCumF-TyyIWF/logo/light.svg?fit=max\u0026auto=format\u0026n=px6-PCumF-TyyIWF\u0026q=85\u0026s=73d901cf8b03ed547c879ca4b742ae75\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.remoteagent.chat#website\",\"name\":\"RemoteAgent.CHAT\",\"url\":\"https://docs.remoteagent.chat\",\"publisher\":{\"@id\":\"https://docs.remoteagent.chat/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.remoteagent.chat/runners/codex#webpage\",\"url\":\"https://docs.remoteagent.chat/runners/codex\",\"name\":\"codex\",\"description\":\"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\",\"dateModified\":\"2026-04-14T14:01:24.683Z\",\"isPartOf\":{\"@id\":\"https://docs.remoteagent.chat#website\"},\"breadcrumb\":{\"@id\":\"https://docs.remoteagent.chat/runners/codex#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.remoteagent.chat/runners/codex#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Runners\",\"item\":\"https://docs.remoteagent.chat/runners/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"codex\",\"item\":\"https://docs.remoteagent.chat/runners/codex\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.remoteagent.chat/runners/codex#article\",\"headline\":\"codex\",\"name\":\"codex\",\"description\":\"Use Codex CLI by OpenAI as the AI runner — runs codex exec --json non-interactively with structured JSONL output. Supports API key auth or device login with no browser required on the server.\",\"url\":\"https://docs.remoteagent.chat/runners/codex\",\"mainEntityOfPage\":{\"@id\":\"https://docs.remoteagent.chat/runners/codex#webpage\"},\"dateModified\":\"2026-04-14T14:01:24.683Z\",\"publisher\":{\"@id\":\"https://docs.remoteagent.chat/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.remoteagent.chat#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"RemoteAgent.CHAT\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"RemoteAgent.CHAT\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/runners/codex.md","siteName":"RemoteAgent.CHAT","nav":{"global":{"anchors":[{"anchor":"remoteagent.chat","icon":"house","href":"https://remoteagent.chat"},{"anchor":"Telegram bot","icon":"paper-plane","href":"https://t.me/remoteagent_bot"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Overview","pages":[{"title":"What is RemoteAgent.CHAT?","href":"/introduction"}]},{"group":"Getting Started","pages":[{"title":"Quickstart","href":"/getting-started/quickstart"},{"title":"Pairing","href":"/getting-started/pairing"},{"title":"Best Practices","href":"/getting-started/best-practices"}]},{"group":"Runners","pages":[{"title":"Runners overview","href":"/runners/overview"},{"title":"claude-code","href":"/runners/claude-code"},{"title":"claude-sdk","href":"/runners/claude-sdk"},{"title":"opencode","description":"Use OpenCode as the default AI runner — open-source terminal AI coding agent by the SST team, supports 75+ providers with no API key required.","href":"/runners/opencode"},{"title":"codex","href":"/runners/codex"},{"title":"gemini","description":"Use Google Gemini CLI as the AI runner. Free tier available — no credit card required.","href":"/runners/gemini"},{"title":"aider","href":"/runners/aider"},{"title":"openclaw","href":"/runners/openclaw"},{"title":"custom","href":"/runners/custom"}]},{"group":"Using the Bot","pages":[{"title":"Sending commands","href":"/bot/sending-commands"},{"title":"Multi-project","href":"/bot/multi-project"},{"title":"Offline alerts","href":"/bot/offline-alerts"}]},{"group":"Platform","pages":[{"title":"Dashboard","href":"/dashboard"},{"title":"Pricing","href":"/pricing"}]},{"group":"Under the Hood","pages":[{"title":"Architecture","href":"/under-the-hood/architecture"},{"title":"Services","href":"/under-the-hood/services"},{"title":"Security","href":"/under-the-hood/security"}]},{"group":"Reference","pages":[{"title":"CLI reference","href":"/cli-reference"}]},{"group":"Support","pages":[{"title":"FAQ","href":"/faq"}]}]}]},"basePath":"","title":"codex - RemoteAgent.CHAT","deploymentId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","buildId":"dpl_vSEmv961Ncyvz1psVwgUnTXQMSYk","dynamics":[],"chunks":[]}