Codex CLI

Last updated:

On this page

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:

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"
bash
export STAIK_API_KEY=sk-st-your-key
codex

The 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>:

ModelGood for
qwen3.6:35b-a3bDefault. Best at code and tool calls, 262K context
qwen3.5:9bFast, simpler tasks
gemma4:31bReview and a second opinion
qwen3.6:35b-a3b-thinkingHarder 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, conversation and background return 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_search and file_search are 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_KEY is set in the same shell you start codex from.
  • 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.