Codex Bridge is a local HTTP API for VS Code Codex automation. It runs as a VS Code extension and exposes the installed OpenAI ChatGPT/Codex extension through a stable, scriptable loopback API that external tools can call.
If you want to start Codex tasks from another app, continue an existing Codex conversation, monitor worker status, and keep those conversations visible in the VS Code Codex history sidebar, this repo is for that.
The Codex UI inside VS Code is useful for interactive work, but automation needs a programmable interface:
- a way to create a new Codex conversation without typing manually
- a way to resume a known conversation by id
- a way to detect whether the worker is starting, running, completed, or failed
- a way to let another process trigger Codex work as part of a larger pipeline
Codex Bridge adds that missing API layer locally on the same machine where VS Code is running.
- Starts a brand new Codex conversation with an initial task prompt
- Continues an existing Codex conversation by
conversationId - Opens or focuses the matching Codex tab in VS Code
- Tracks each dispatched run as a job with lifecycle state and timestamps
- Creates new bridge conversations as
vscodethreads so they appear in the Codex history sidebar - Upgrades older legacy bridge conversations into history-visible threads when they are continued
- developers building local automation around Codex in VS Code
- tool builders who want a lightweight local Codex API
- people creating feedback loops, worker queues, or orchestration systems around Codex
- teams that want VS Code Codex chat automation without manually driving the UI
conversation: a Codex thread in the VS Code ChatGPT/Codex extensionjob: one dispatched worker run tracked by the bridgehistory-visible thread: a conversation created through the Codex app-server as avscodesource thread, which appears in the Codex history sidebar
- Local HTTP API on
127.0.0.1:8765by default - Pollable job lifecycle:
starting,running,completed,failed - Conversation discovery endpoints for current and open tabs
- Auth token support for non-default local deployments
- OpenAPI spec for downstream integrations
- GitHub Actions CI
- Zero external runtime dependencies in the extension itself
- VS Code 1.90 or newer
- OpenAI ChatGPT extension installed in VS Code
- Codex access available in that extension
- Node.js 22 or newer for local validation and packaging
Codex Bridge runs inside VS Code as an extension. When a client sends an HTTP request:
- the bridge receives the request on the local HTTP server
- it starts or resumes a Codex thread using the bundled Codex app-server when possible
- it starts a turn with the provided message
- it tracks notifications from the Codex worker and updates an in-memory job record
- it tries to reveal the matching conversation tab in VS Code
- it exposes the result through
/jobsand the conversation endpoints
The preferred path uses the Codex app-server because that creates vscode source threads, which is what makes bridge-created conversations show up in the Codex history sidebar.
Some advanced request options are not available through the app-server transport yet. For those, the bridge falls back to the CLI exec path. Those fallback runs may not appear in the history sidebar because they are created as exec source threads instead.
More detail is in docs/ARCHITECTURE.md.
Base URL:
http://127.0.0.1:8765
Endpoints:
GET /healthGET /jobsGET /jobs/:jobIdGET /conversations/openGET /conversations/currentPOST /conversationsPOST /conversations/current/messagesPOST /conversations/:conversationId/messages
Reference docs:
- machine-readable spec: openapi.json
- endpoint guide: docs/API.md
- troubleshooting: docs/FAQ.md
This repo now includes an installable skill bundle in skills/codex-bridge-api. It is meant for OpenClaw, Codex, and other agents that consume the standard SKILL.md plus agents/openai.yaml format.
The skill gives an agent a direct, repeatable workflow for:
- checking whether the local bridge is running
- starting a new VS Code Codex task
- continuing an existing conversation by id
- polling a job until the worker finishes
Install it with the open skills CLI:
npx skills add pesoszpesosz/codex-bridge-vscode-api --skill codex-bridge-api -a openclawInstall it for Codex with:
npx skills add pesoszpesosz/codex-bridge-vscode-api --skill codex-bridge-api -a codexThe bundled helper script is bridge_client.py.
- Clone this repository.
- Open it in VS Code.
- Launch an Extension Development Host with
F5, or package/install the extension as a VSIX. - Confirm the bridge is running:
curl http://127.0.0.1:8765/healthThe bridge auto-starts by default.
curl -X POST http://127.0.0.1:8765/conversations \
-H "Content-Type: application/json" \
-d "{\"message\":\"Inspect this repo and fix the failing tests\",\"cwd\":\"C:\\\\path\\\\to\\\\repo\",\"approvalPolicy\":\"never\",\"sandbox\":\"danger-full-access\"}"This starts a new Codex conversation, dispatches the first task, returns a conversationId, and includes a job plus jobUrl so your automation can poll for completion.
curl -X POST http://127.0.0.1:8765/conversations/CONVERSATION_ID/messages \
-H "Content-Type: application/json" \
-d "{\"message\":\"Continue and finish the implementation\",\"ensureOpen\":true}"If the requested conversation was an older legacy exec conversation, the bridge upgrades it into a history-visible vscode thread and returns both the requested id and the upgraded id.
curl http://127.0.0.1:8765/jobs/JOB_IDJob records include:
- lifecycle status
- timestamps
conversationId- open/focus status
- event counts
- last event type
- exit details
- failure information
The request body can include:
messagecwdapprovalPolicysandboxdangerouslyBypassApprovalsAndSandboxmodelserviceTierbaseInstructionsdeveloperInstructionspersonalityconfigimagessendTimeoutMsopenTimeoutMsoutputSchemaPathoutputLastMessagePathensureOpenupgradeLegacyExecConversations
Recommended settings for fully automated local runs:
approvalPolicy: "never"sandbox: "danger-full-access"
New bridge-created conversations are started through the Codex app-server, which records them as vscode source threads. That is what makes them visible in the Codex history sidebar.
Older bridge-created conversations that were started through the legacy CLI exec path remain exec source threads. When you continue one through the bridge, it is automatically upgraded into a new history-visible vscode thread unless you explicitly disable that behavior.
This API is local by design.
- The default bind address is loopback only:
127.0.0.1 - Optional bearer token support is available through
codexBridge.authToken - If you bind to anything other than loopback, set an auth token
danger-full-accessshould only be used on trusted machines and trusted tasks
If codexBridge.authToken is configured, clients must send one of:
Authorization: Bearer <token>X-Codex-Bridge-Token: <token>
Codex Bridge: Start ServerCodex Bridge: Stop ServerCodex Bridge: Show Status
- extension.js: bridge implementation
- openapi.json: OpenAPI contract
- smoke-test.js: mocked smoke suite
- docs/API.md: endpoint and payload guide
- docs/ARCHITECTURE.md: system internals
- docs/FAQ.md: troubleshooting and common questions
Run local validation:
npm testThat runs:
node --check extension.jsnode smoke-test.js
CI is defined in .github/workflows/ci.yml.
Contribution guidance is in CONTRIBUTING.md.
This repo is ready to publish to GitHub.
If you want to publish the extension to the VS Code Marketplace, change the publisher field in package.json to your publisher id before packaging or publishing.
- This depends on internal behavior of the installed OpenAI ChatGPT/Codex extension. It is not an official stable OpenAI API.
- If the ChatGPT/Codex extension changes its internal app-server behavior, bundled CLI layout, or conversation URI format, this bridge may need updates.
- Continuing an existing conversation still requires its
conversationId.