Codex

Add SipToken as a Codex provider and use GPT models.

Before you start

  • A SipToken key in the Official group. If you don't have one yet, see Quickstart.
  • Base URL: https://api.siptoken.ai/v1. Include /v1: Codex only appends /responses.
  • Codex only uses the Responses format (/v1/responses). Pick gpt-6.2-astra, gpt-6.1-sol or gpt-6-luna.
  • Codex reads the key from an environment variable. This guide uses SIPTOKEN_API_KEY.

Install

macOS / Linux:

curl -fsSL https://chatgpt.com/codex/install.sh | sh

Windows PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"

You can also use npm (Node.js required) or Homebrew:

npm install -g @openai/codex
brew install --cask codex

Install docs: developers.openai.com/codex/cli.

Configure

There are two steps: make the key a persistent environment variable, then add a SipToken provider to config.toml.

Set the key

On macOS / Linux with zsh:

echo 'export SIPTOKEN_API_KEY="sk-xxxxxxxx"' >> ~/.zshrc
source ~/.zshrc

With bash, use ~/.bashrc instead of ~/.zshrc.

Windows PowerShell:

setx SIPTOKEN_API_KEY "sk-xxxxxxxx"

setx doesn't affect the current window. Close the terminal afterwards and open a new one.

Edit config.toml

On macOS / Linux the file is ~/.codex/config.toml:

mkdir -p ~/.codex
nano ~/.codex/config.toml

On Windows the file is %USERPROFILE%\.codex\config.toml:

New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex" | Out-Null
notepad "$env:USERPROFILE\.codex\config.toml"

The contents are the same on both systems:

model = "gpt-6.2-astra"
model_provider = "siptoken"

[model_providers.siptoken]
name = "SipToken"
base_url = "https://api.siptoken.ai/v1"
env_key = "SIPTOKEN_API_KEY"
wire_api = "responses"
requires_openai_auth = false

A few things to watch:

  • model and model_provider must be at the very top of the file, before any [...] table. If they come after a table, Codex reads them as part of that table and the provider never takes effect.
  • If the file already has content, insert these two lines at the top. The [model_providers.siptoken] table can go anywhere after them.
  • It has to be this file in your home directory. A project's .codex/config.toml ignores model_provider and model_providers.
  • The provider ID can't be openai. That name is reserved.

The key doesn't go in config.toml. Codex reads it from the SIPTOKEN_API_KEY environment variable named in env_key, so the config file is safe to sync to other machines.

Import with CC Switch

If you'd rather not edit the file by hand, CC Switch can manage it. It writes config.toml for you and has a model mapping table where you declare SipToken models. See CC Switch.

Temporary environment variables

Once config.toml is set up, you can try a different key in the current terminal with a temporary variable.

macOS / Linux:

export SIPTOKEN_API_KEY="sk-xxxxxxxx"
codex

Windows PowerShell:

$env:SIPTOKEN_API_KEY = "sk-xxxxxxxx"
codex

To switch models for one run, use codex --model gpt-6.1-sol.

Verify

Check the version and run diagnostics:

codex --version
codex doctor

Then send a test message:

codex exec "Reply with exactly: gateway-ok"

If it returns gateway-ok, you're connected.

You can also start an interactive session and run /status to confirm the model is gpt-6.2-astra and the provider is SipToken.

If it still fails, make sure the current terminal can see the key:

echo $SIPTOKEN_API_KEY
echo $env:SIPTOKEN_API_KEY

Then test the key itself with the curl commands in Quickstart.

Common errors

ErrorCause and fix
Still asks for a ChatGPT login, or requests don't go to SipTokenUsually model_provider is below a table, or it's in a project config. Move it to the top of the user-level config.toml.
Says the SIPTOKEN_API_KEY environment variable is missingThe key isn't set. On Windows, open a new terminal after setx. For the desktop app, quit it fully and reopen.
401, "invalid token"Usually the key is wrong or no longer valid. Check it on the Tokens page and set the variable again.
403, mentions quotaUsually your balance or the key's quota is used up. Top up on the Wallet page or raise the key's quota.
404Usually base_url is missing /v1. Change it to https://api.siptoken.ai/v1.
503, "no available channel"Usually a typo in the model name. Check with GET /v1/models and pick a gpt-* model.
429Usually you've hit 120 requests per minute. Wait a moment and retry.
stream disconnected or timeoutsUsually a network hiccup or a very long generation. Codex retries on its own. If it keeps happening, raise stream_idle_timeout_ms in the provider table. The default is 300000 (5 minutes).

FAQ

Can I use Claude or other models in Codex?

Codex only sends Responses-format requests, so gpt-* models are recommended. Whether other models work depends on testing.

It says there's no info for this model, or the context length looks wrong

Codex only knows the model names in its built-in catalog. For names it doesn't know, it falls back to default settings, so the context length may be shown wrong. Add model_context_window at the top of config.toml, using the context length listed on Models. If you use CC Switch, you can set the context window in its model mapping table instead.

Do the desktop app and IDE extension work?

Yes. They read the same ~/.codex/config.toml. But an environment variable set in a terminal may not reach the desktop app. On Windows, restart the desktop app after running setx. On macOS, apps opened from the Dock don't read ~/.zshrc, so launch it from a terminal or manage it with CC Switch instead.

I want to keep my ChatGPT login and use SipToken only when I need it

Remove the model and model_provider lines from the top of config.toml and keep only the [model_providers.siptoken] table. Then create ~/.codex/siptoken.config.toml:

model = "gpt-6.2-astra"
model_provider = "siptoken"

Start Codex with codex --profile siptoken when you want SipToken. This needs Codex 0.134.0 or later.

Can I change the reasoning effort?

Add model_reasoning_effort at the top of config.toml, for example model_reasoning_effort = "high". The accepted values depend on the model.

No key yet?Sign up and top up, then create one on the Tokens page in the console.
Create one in the console →