TokiLabsDocs
Tools

Codex CLI

Codex CLI is OpenAI's command-line coding assistant. With a custom model provider, it can use Toki Labs GPT models.

One key works with every model. Your key is stored only in your own browser and is never uploaded to any server.
Codex is an OpenAI-format tool, so the endpoint needs /v1 at the end. The key is the same as for other tools.

Install

Terminal / PowerShell
npm install -g @openai/codex

Configure config.toml

SystemFile location
Windows%USERPROFILE%\.codex\config.toml
macOS / Linux~/.codex/config.toml
config.toml
model_provider = "tokilabs"
model = "gpt-6.1-sol"

[model_providers.tokilabs]
name = "Toki Labs"
base_url = "https://api.tokilabs.xyz/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"

Write it with one command:

PowerShell
New-Item -ItemType Directory -Force "$HOME\.codex" | Out-Null
[IO.File]::WriteAllText("$HOME\.codex\config.toml", @'
model_provider = "tokilabs"
model = "gpt-6.1-sol"

[model_providers.tokilabs]
name = "Toki Labs"
base_url = "https://api.tokilabs.xyz/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
'@)
This overwrites any existing config.toml. If you already have settings, merge them manually.

Set the key

env_key = "OPENAI_API_KEY" tells Codex to read the key from this environment variable. If it is not set yet:

PowerShell (Reopen the terminal after setting it)
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "sk-your-key", "User")

Run and switch models

Terminal
codex
# Specify a model temporarily
codex -m gpt-6-sol

You can also type /model in a session to switch. See the model list for available models.

Common issues

  • Still asks to sign in to ChatGPT: make sure model_provider = "tokilabs" is at the very top of the file (before any [...] section).
  • 401 / Missing API key: the current terminal cannot see OPENAI_API_KEY. Reopen the terminal and check with echo $OPENAI_API_KEY (in PowerShell, $env:OPENAI_API_KEY).
  • Model does not exist: check that the model name matches the model list exactly.