Codex CLI & Extension Setup (OpenAI API)
Use the OpenAI API in OpenAI Codex CLI and the Codex VS Code extension through LLMsRelay. Configure the Responses API endpoint in under a minute.
Base URL: https://api.llmsrelay.com/v1. Endpoint: POST /v1/responses. API key: sk-cs4-* (Codex group). Models: gpt-5.5, gpt-5.4. Setup time: ~1 minute.
Overview
OpenAI's Codex CLI and the Codex VS Code extension talk to a model provider over the Responses API (/v1/responses). LLMsRelay serves that endpoint, so you can drive the OpenAI API through your existing LLMsRelay credits and a Codex-group key.
/v1/chat/completions instead? See the OpenAI-Compatible IDEs guide.Step 1 — Create a Codex key
In the dashboard → API keys, create ansk-cs4-… key and select theCodex group. It looks likesk-cs4-…. Copy it once — it's shown only at creation.
Step 2 — Switch the tier to Codex
Confirm that the key group is Codex. This routes the key to the OpenAI API. Create a separate Basic or Pro key for Claude if both providers must stay active; the account balance remains shared.
Codex group serves the OpenAI API only
gpt-5.5) use the OpenAI endpoints. Claude model ids and /v1/messages are not used on this tier.Step 3 — Configure Codex CLI
Codex CLI reads ~/.codex/config.toml. Add LLMsRelay Codex as a model provider that uses the Responses API:
model = "gpt-5.5"
model_provider = "llmsrelay"
[model_providers.llmsrelay]
name = "LLMsRelay Codex"
base_url = "https://api.llmsrelay.com/v1"
env_key = "LLMSRELAY_API_KEY"
wire_api = "responses"Export your Codex-group key as the provider env var, then launch Codex:
export LLMSRELAY_API_KEY="sk-cs4-your-key"
codexwire_api = "responses" is what makes Codex CLI call /v1/responses. Streaming works out of the box.Step 4 — Codex VS Code extension
The Codex VS Code extension shares the same ~/.codex/config.toml. Once the provider above is set and LLMSRELAY_API_KEY is exported in your shell environment, the extension picks up LLMsRelay Codex automatically. Select the gpt-5.5 model from the extension's model picker.
Step 5 — Test
You can verify the endpoint directly without the CLI:
curl https://api.llmsrelay.com/v1/responses \
-H "Authorization: Bearer sk-cs4-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "Say hello in 3 words."
}'A successful response confirms the key, tier, and endpoint are wired correctly. If you get a model error, run GET /v1/models to confirm the model id.
Troubleshooting
- Unknown model — the key is not in the Codex group, or the model id is wrong. Check the group and
GET /v1/models. - 401 / unauthorized — the env var isn't exported in the shell that launched Codex.
- Endpoint not found — make sure the base URL ends in
/v1and the provider useswire_api = "responses".