Codex CLI
Codex CLI is OpenAI's official command-line coding assistant. It supports configuring custom OpenAI-compatible providers via ~/.codex/config.toml, so you can route requests to Sakrylle.
- Repo: https://github.com/openai/codex
- Docs: https://developers.openai.com/codex
- Current version: 0.133.0 (2026-05-21)
Prerequisites
- Codex CLI installed per the official instructions
- An API Key created in the Sakrylle Console
Configuration
1. Set key
export SAKRYLLE_API_KEY="<your Sakrylle key>"Add it to your shell config (~/.zshrc / ~/.bashrc) for persistence.
2. Edit config
Create the file if it doesn't exist, and add:
model = "gpt-5.6-sol"
model_provider = "sakrylle"
[model_providers.sakrylle]
name = "Sakrylle API"
base_url = "https://api.sakrylle.com/v1"
env_key = "SAKRYLLE_API_KEY"
wire_api = "responses"Field reference:
model: default model namemodel_provider: top-level pointer to the[model_providers.X]block below; cannot use reserved names likeopenai/ollama/lmstudiobase_url: Sakrylle's OpenAI-compatible endpoint, with/v1env_key: name of the environment variable the CLI reads the API Key fromwire_api:responsesmeans using OpenAI Responses API; if you want to force Chat Completions, set it to"chat"(Sakrylle supports both endpoints)
3. Verify
codexOnce in interactive mode, try a simple prompt — for example, ask it to explain the file structure of the current directory.
Multiple profiles
If you want to use Sakrylle and also keep a direct connection to official OpenAI, use profiles:
[profiles.sakrylle]
model = "gpt-5.6-sol"
model_provider = "sakrylle"
[profiles.openai]
model = "gpt-5.4"
model_provider = "openai"
[model_providers.sakrylle]
name = "Sakrylle API"
base_url = "https://api.sakrylle.com/v1"
env_key = "SAKRYLLE_API_KEY"
wire_api = "responses"Start with codex --profile sakrylle.
Remote Compact
When conversation history approaches the context window limit, Codex performs a compact — summarizing the lengthy history into shorter text to free up space for continued conversation.
By default, compact runs locally (the Codex CLI itself calls the current model to generate the summary). However, if the gateway supports remote compact, the summarization is offloaded to the server side — the client just sends one request and gets back the compressed result, which is faster and uses fewer tokens.
Enabling Remote Compact
To use remote compact via Sakrylle, the name field in your config.toml provider block must be set to "OpenAI" (this is the signal Codex uses to detect remote compact support):
model = "gpt-5.6-sol"
model_provider = "sakrylle"
[model_providers.sakrylle]
name = "OpenAI"
base_url = "https://api.sakrylle.com/v1"
env_key = "SAKRYLLE_API_KEY"
wire_api = "responses"name = "OpenAI" and the -openai-compact suffix
When name is set to "OpenAI", Codex automatically requests {base_model}-openai-compact from the gateway when it needs to compact (e.g. gpt-5.5 → gpt-5.5-openai-compact). Sakrylle's GPT-Pro / GPT-Pro-Special groups both support these -openai-compact variants, priced identically to their base models.
If the gateway does not provide -openai-compact models (e.g. you're not using Sakrylle, or the group doesn't include them), setting name = "OpenAI" will cause compact to fail. In that case, change the name back to a custom value (like "Sakrylle API") to fall back to local compact.
Compact models
-openai-compact is an OpenAI-defined suffix for the remote compact scenario. It's not an independent model — it's a compact-specific alias for the base model:
| Base model | Compact model |
|---|---|
gpt-5.5 | gpt-5.5-openai-compact |
gpt-5.4 | gpt-5.4-openai-compact |
The two variants are priced identically — Sakrylle does not charge extra for compact requests.
If you'd rather use a different model for compact (instead of the automatic match), you can remove the -openai-compact suffix from the model name, and Codex will fall back to local compact.
FAQ
Provider 'openai' is reservederror: themodel_providersblock name cannot beopenai; use a custom name likesakrylle- 401 / authentication failed: check whether
SAKRYLLE_API_KEYis actually exported (echo $SAKRYLLE_API_KEY); also ensureenv_keymatches the environment variable name - 404 / model not found: change
modelto a valid name listed in Models and Pricing - Responses API errors: try setting
wire_apito"chat"; if a model only supports one of the APIs, the Sakrylle error code will say which - 402 insufficient balance: top up in the Console
- Compact errors / compact fails: if your
config.tomlhasname = "OpenAI"but the group doesn't support-openai-compactmodels, Codex's remote compact will fail. Changenameto a non-"OpenAI"value (like"Sakrylle API") to fall back to local compact. See the Remote Compact section above
