Skip to content
OpenAI Codex logo

Codex CLI via Tokonomix

Define a Tokonomix model_provider in Codex CLI’s config.toml — point OpenAI’s coding agent at 130+ models and consensus on one key.

Custom model_provider (config.toml)Terminal coding agentApache-2.0 · open sourcemacOS · Linux · Windows
Codex CLI — OpenAI’s coding agent in your terminal, via Tokonomix

What is Codex CLI?

Codex CLI is OpenAI’s open-source coding agent for the terminal. It reads your repo, proposes and applies edits, and runs commands in a sandbox. A model provider in config.toml defines how it connects — base URL, wire API and auth — so it isn’t locked to OpenAI’s own endpoint.

  • An agentic terminal coder with sandboxed command execution.
  • Connects to any OpenAI-compatible endpoint via a custom [model_providers.<id>] table.
  • Supports a wire_api of chat (Chat Completions) or responses.
  • Open source; configured entirely from ~/.codex/config.toml.

Why route Codex CLI through Tokonomix?

Codex CLI is excellent, but pinned to one vendor’s models by default. A Tokonomix model_provider opens it to 130+ models across families — and a consensus option for the changes a single model shouldn’t decide alone.

  • One provider entry, 130+ models — switch with the top-level model key.
  • Use tokonomix-consensus for risky refactors, a fast slug for routine edits.
  • Per-call spend caps bound an autonomous coding session.
  • Region / origin routing keeps a code-streaming agent compliant.

Connect Tokonomix in config.toml

Add a [model_providers.tokonomix] table with the Tokonomix base_url, an env_key, and wire_api = "chat" (Tokonomix is Chat Completions-compatible). Then activate it with the top-level model and model_provider keys.

model = "anthropic/claude-sonnet-4-6"
# Opt-in (planning/review only, no tool-calling): model = "tokonomix-consensus"
model_provider = "tokonomix"

[model_providers.tokonomix]
name = "Tokonomix"
base_url = "https://tokonomix.ai/api/v1"
env_key = "TOKONOMIX_API_KEY"
wire_api = "chat"
Reserved IDs

Codex reserves the provider IDs openai, ollama and lmstudio — name your custom provider something else (e.g. tokonomix), then set model_provider = "tokonomix".

Verify it works

  • Export TOKONOMIX_API_KEY, save ~/.codex/config.toml, and start Codex CLI.
  • Run a small task and confirm it uses the Tokonomix provider and model.
  • Check the call and token usage in your Tokonomix dashboard.

Model selection

Which model and endpoint should my agent use?

Pick by what your agent does, then swap the model id any time — every model in the catalog works through the same key.

What your agent doesUse this
Edits files / calls tools and streams responses (most coding agents)An Anthropic model via the Anthropic endpoint (tools + streaming both work)
Calls tools but does not need streaming (any model)The OpenAI-compatible endpoint with a single model id
Wants tools and streaming on a non-Anthropic modelRun non-streaming for now — streaming tool-calls on other providers is not enabled yet
Plain chat, no toolsEither endpoint; streaming is fine
Wants a cross-model verdict (consensus) on a high-stakes answerSet model to tokonomix-consensus on the OpenAI-compatible endpoint — note: consensus rejects tool requests (no tool-calling)
Endpoint & API reference (technical)

anthropic-messages → https://tokonomix.ai/api/anthropic — tools ✓, streaming ✓ (use an Anthropic model). openai-completions → https://tokonomix.ai/api/v1 — tools ✓ (single-model passthrough), streaming with tools not yet enabled. Plain chat: streaming works on both. Consensus: openai-completions, model tokonomix-consensus, no tools. Swap the model id to any slug returned by GET /api/v1/models.

Browse all models →

Related agents