Skip to main content
Codex CLI supports custom model providers in ~/.codex/config.toml — define a Toolken provider, select it, and every Codex request flows through the gateway with full cost tracking.
1

Get your two keys

You need two keys:Toolken forwards your provider key verbatim and never stores it.
2

Add the Toolken provider to config.toml

Open (or create) ~/.codex/config.toml and add the following:
env_key tells Codex which environment variable holds your provider key. That key is sent as Authorization: Bearer and forwarded to the provider untouched.
Keep tk_live_... in an environment variable too. You can reference it with ${TOOLKEN_KEY} if your shell pre-processes the file, or store it directly in config.toml and keep the file out of version control.
3

Set your provider key and run Codex

Export your OpenAI key, then run Codex as normal:
Codex selects the toolken provider from config.toml, attaches X-Toolken-Key and X-Toolken-Metadata-Agent, and routes the request through the gateway.
4

Confirm in your dashboard

Within seconds your request appears in the Toolken dashboard, grouped under the codex agent. Cost, token usage, and latency are all captured automatically.
Codex uses the OpenAI Responses API (/v1/responses). The Toolken gateway supports the Responses API natively, so the integration works without any server-side shim or protocol translation.

Next

Claude Code

Route Claude Code traffic through Toolken with three environment variables.

Continue

Add Toolken as a model provider in Continue’s config.yaml.