Use your ChatGPT subscription to power GoClaw agents via the OpenAI Responses API and OAuth authentication.
The Codex provider lets you use your existing ChatGPT Plus or Pro subscription with GoClaw — no separate API key purchase required. GoClaw authenticates via OAuth using OpenAI's PKCE flow, stores the refresh token securely in the database, and automatically refreshes the access token before it expires.
Under the hood, GoClaw uses the OpenAI Responses API (POST /codex/responses) rather than the standard chat completions endpoint. This API supports streaming, tool calls, and reasoning output. The provider is registered as openai-codex by default.
- You trigger the OAuth flow through GoClaw's web UI (Settings → Providers → ChatGPT)
- GoClaw opens a browser at
https://auth.openai.com/oauth/authorize - You log in with your ChatGPT account and approve access
- OpenAI redirects to
http://localhost:1455/auth/callbackwith an authorization code - GoClaw exchanges the code for access + refresh tokens and stores them encrypted in the database
- From that point on, GoClaw automatically uses and refreshes the token — no manual steps needed
You do not add this provider to config.json manually. Instead:
- Start GoClaw:
./goclaw - Open the web dashboard
- Go to Settings → Providers
- Click Connect ChatGPT
- Complete the OAuth flow in your browser
Once connected, set an agent to use it:
{
"agents": {
"defaults": {
"provider": "openai-codex",
"model": "gpt-5.3-codex"
}
}
}The Codex provider supports models available through the Responses API:
| Model | Notes |
|---|---|
gpt-5.3-codex |
Default; optimized for agentic coding tasks |
o3 |
Strong reasoning model |
o4-mini |
Faster reasoning, lower cost |
gpt-4o |
General-purpose, multimodal |
Pass the model name in the model field of your agent config or per-request.
For reasoning models (like o3, o4-mini), set thinking_level to control reasoning effort:
{
"agents": {
"defaults": {
"provider": "openai-codex",
"model": "o3",
"thinking_level": "medium"
}
}
}GoClaw translates this to the Responses API reasoning.effort field (low, medium, high).
The Codex provider uses the Responses API format, not chat completions:
- System prompts become
instructionsin the request body - Messages are converted to the
inputarray format - Tool calls use
function_callandfunction_call_outputitem types - Tool call IDs are prefixed with
fc_as required by the Responses API store: falseis always set (GoClaw manages its own conversation history)
This conversion is transparent — you interact with GoClaw the same way regardless of which provider is active.
Agent config after OAuth setup:
{
"agents": {
"defaults": {
"provider": "openai-codex",
"model": "gpt-5.3-codex",
"max_tokens": 8192
}
}
}Use reasoning with o3:
{
"agents": {
"list": {
"reasoning-agent": {
"provider": "openai-codex",
"model": "o3",
"thinking_level": "high"
}
}
}
}If you have multiple ChatGPT accounts (e.g., a personal account and a work account), you can pool them together so GoClaw distributes requests across all of them. This is useful for spreading usage across accounts or providing automatic failover when one account hits a limit.
You connect each ChatGPT account as a separate chatgpt_oauth provider. One provider is the pool owner — it holds the routing configuration. The other providers are pool members listed in extra_provider_names.
When creating or updating a provider via POST /v1/providers, set the settings field:
{
"name": "openai-codex",
"provider_type": "chatgpt_oauth",
"settings": {
"codex_pool": {
"strategy": "round_robin",
"extra_provider_names": ["codex-work", "codex-shared"]
}
}
}strategy controls how requests are distributed across the pool:
| Strategy | Behavior |
|---|---|
primary_first |
Always use the primary account; extras are only tried on retryable failures (default) |
round_robin |
Rotate requests across the primary + all extra providers |
priority_order |
Try providers in order — primary first, then extras in sequence |
extra_provider_names is the authoritative membership list. A provider listed in another pool's extra_provider_names cannot manage its own pool.
Individual agents can override the pool behavior via chatgpt_oauth_routing in their other_config:
{
"other_config": {
"chatgpt_oauth_routing": {
"override_mode": "custom",
"strategy": "priority_order"
}
}
}override_mode options:
| Value | Behavior |
|---|---|
inherit |
Use the primary provider's codex_pool settings (default when not set) |
custom |
Apply this agent's own strategy override |
Setting override_mode: "custom" with no extra_provider_names and strategy primary_first disables the pool for that agent — it will only use the primary account.
- Retryable upstream failures (HTTP 429, 5xx) automatically fall through to the next eligible account in the same request.
- OAuth login and logout are per-provider — each account authenticates independently.
- The pool is only active when the agent's provider is a
chatgpt_oauthtype. Non-Codex providers are unaffected.
To inspect routing decisions and per-account health for an agent, call:
GET /v1/agents/{id}/codex-pool-activity
See REST API for the response shape.
| Problem | Cause | Fix |
|---|---|---|
401 Unauthorized |
Token expired or revoked | Re-authenticate via Settings → Providers → ChatGPT |
| OAuth callback fails | Port 1455 blocked | Ensure nothing else is listening on port 1455 during auth |
model not found |
Model not in your subscription | Check your ChatGPT plan; some models require Pro |
| Provider not available after restart | Token not persisted | GoClaw auto-loads the token from DB on startup; check DB connectivity |
| Phase field in response | gpt-5.3-codex returns commentary + final_answer phases |
GoClaw handles this automatically; both phases are captured |
- Custom Provider — connect any OpenAI-compatible API including local models
- Claude CLI — use your Claude subscription instead