Codex CLI
Last updated:
Run OpenAI Codex CLI against staik. Swedish GPUs,
and your code never leaves Sweden. Codex speaks OpenAI's Responses API, and staik
answers on the same protocol via POST /v1/responses.
Configuration
Add staik as a provider in ~/.codex/config.toml:
model = "qwen3.6:35b-a3b"
model_provider = "staik"
model_context_window = 262144
[model_providers.staik]
name = "staik"
base_url = "https://api.staik.se/v1"
env_key = "STAIK_API_KEY"
wire_api = "responses"export STAIK_API_KEY=sk-st-your-key
codexThe key is sent as Authorization: Bearer. base_url points at /v1, and Codex
appends /responses itself.
Why model_context_window?
Codex doesn't know staik's models and otherwise assumes its own context window.
With model_context_window = 262144, Codex knows when the history needs to be
compacted. Codex may still show the warning Model metadata for ... not found.
It doesn't affect the run.
Models
Change model in config.toml, or pick a model per run with codex -m <model>:
| Model | Good for |
|---|---|
qwen3.6:35b-a3b | Default. Best at code and tool calls, 262K context |
qwen3.5:9b | Fast, simpler tasks |
gemma4:31b | Review and a second opinion |
qwen3.6:35b-a3b-thinking | Harder problems where the model reasons first |
See Models for context windows and details, and Thinking and reasoning for the thinking aliases.
What's supported
Codex works as usual: it reads files, runs commands and edits code through its own
tools, which staik passes on to the model as function tools. Streaming,
instructions, parallel tool calls, structured output (text.format) and
max_output_tokens are supported.
Limitations
- No server-side storage.
previous_response_id,conversationandbackgroundreturn 400. Codex sends the full history with every request, so this doesn't affect Codex. - No web search through Codex. Hosted tools such as
web_searchandfile_searchare ignored, since the model can only call function tools. - Tool calls aren't streamed token by token. Responses that contain tool calls arrive once the whole response is ready.
Troubleshooting
- 401 Unauthorized: check that
STAIK_API_KEYis set in the same shell you startcodexfrom. - 400 about
previous_response_id: the client is trying to use stored responses, which staik doesn't have. Codex sends the full history and isn't affected. - 429: you've hit your plan's token limit or the capacity ceiling. See Errors.
Prefer Claude Code or OpenCode? See Claude Code and OpenCode.