Setup guide
Use Codex with a custom API endpoint
Yes. Codex works with Token Supply. Keep the Codex CLI, app, or VS Code extension you already use. Point the provider at Token Supply, set your API key, and keep the Responses API.
~/.codex/config.toml · ~/.codex/auth.json
Four files and a restart
Create an API key
Register, add credit, and create a key in API Keys. A new key works for every client. Copy ts_live_... once.
Edit config.toml
Set model_provider, model, reasoning effort, and a Token Supply provider block.
Add auth.json
Store the Token Supply key as OPENAI_API_KEY.
Restart Codex
Select the configured model. A short test request should appear in Usage.
Who this is for
Codex CLI, Codex App, and VS Code extension users who already run an OpenAI-plan key and want the Responses API left intact.
What you need
Use your Token Supply API key. A new key works for every client. The model must be one Codex accepts. Older keys still only serve the plan they were created for.
This setup works for Codex CLI, Codex App, and the Codex VS Code extension.
- Base URL: https://api.token-supply.com
- wire_api must be responses. Do not use chat.
- disable_response_storage and store: false. Codex should not persist Responses on the provider.
Edit config.toml
Open ~/.codex/config.toml. On Windows, open %USERPROFILE%\.codex\config.toml.
Keep the normal Codex provider setup and change the values to Token Supply. Do not put the provider block in a project .codex/config.toml; Codex ignores provider settings there.
model_provider = "token_supply"
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
model_reasoning_summary = "auto"
model_context_window = 1050000
disable_response_storage = true
supports_websockets = false
[model_providers.token_supply]
name = "Token Supply"
base_url = "https://api.token-supply.com"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false
[features]
goals = true
Why this works: wire_api stays responses, so Codex keeps the API it already calls.
- On Windows, use %USERPROFILE%\.codex for both files.
- wire_api must be responses. Do not use chat.
- model_reasoning_effort accepts minimal, low, medium, high, or xhigh for the example model. gpt-6.1-sol accepts low, medium, high, xhigh, or max, and does not accept none or minimal.
- GPT-6.1 Sol, GPT-6 Sol, GPT-6 Luna, GPT-5.6 Sol, and GPT-5.5 use a 1,050,000 token context window.
- gpt-6.1-terra is also an OpenAI-plan id. The example model stays gpt-5.6-sol. Its rates are not the rates for other models.
Add the key
Open ~/.codex/auth.json and use your Token Supply key as the OpenAI key.
{
"OPENAI_API_KEY": "ts_live_..."
}
Why this works: The key lives in auth.json, separate from the provider block.
Verify
Restart Codex and select gpt-5.6-sol, or another OpenAI id such as gpt-6.1-sol, gpt-6-sol, gpt-6-luna, or gpt-6.1-terra, on that key's plan. Send a short prompt, then open Usage in Token Supply.
If you want a lower listed rate on the same Codex workflow, compare models in the savings calculator before you change the config.
Details
- Does Codex work with Token Supply?
- Yes. Codex CLI, Codex App, and VS Code extension users who already run an OpenAI-plan key and want the Responses API left intact.
- Why responses instead of chat?
- Codex uses the Responses API. wire_api must be responses or the client will call the wrong path.
- Can I keep my current Codex model name?
- Use a model included in the Token Supply plan on that key. The name in the snippet is an example.
- Where do I put the key on Windows?
- Both config.toml and auth.json live under %USERPROFILE%\.codex.
Related
- Cursor OpenAI-compatible API — Override the OpenAI base URL and paste your API key.
- OpenCode custom provider — OpenAI, Anthropic, Gemini, and Grok presets.
- OpenAI SDK custom base URL — Point the OpenAI client at Token Supply.
- AI API token cost calculator — Compare listed Token Supply rates with public list prices.