Use CoralBricks with Codex CLI
Point OpenAI's Codex CLI at CoralBricks open models — GLM and Kimi with up to 1M context — with one provider block in config.toml.
Codex CLI is OpenAI's open-source terminal
coding agent. It lets you register a custom model provider, so you can run
Codex on GLM 5.2 or Kimi K3 through CoralBricks — billed to your CoralBricks
account instead of an OpenAI key.
Codex speaks the Responses API. As of early 2026 Codex custom providers
must use wire_api = "responses" (the older "chat" value was removed).
CoralBricks serves the OpenAI Responses API natively at
https://inference.coralbricks.ai/v1/responses, so no translating proxy is
needed — the config below works as-is.
1. Get an API key
Create a key from your API keys page (format cb_...).
2. Add CoralBricks as a provider
Add a provider block to ~/.codex/config.toml and select it as the default:
model = "glm-5.2-fp4"
model_provider = "coralbricks"
[model_providers.coralbricks]
name = "CoralBricks"
base_url = "https://inference.coralbricks.ai/v1"
env_key = "CORALBRICKS_API_KEY"
wire_api = "responses"
env_key names the environment variable Codex reads the key from. Export your
cb_... key under that name:
export CORALBRICKS_API_KEY="cb_your_key_here"
Add the line to your shell profile (~/.zshrc, ~/.bashrc) so it persists.
3. Run
codex
Codex now runs its agent loop — planning, editing files, and calling tools — on
glm-5.2-fp4 through CoralBricks. Switch models per run without editing the
config:
codex -c model=kimi-k3
Available models
| Model |
Model ID |
Context |
Input $/M |
Output $/M |
| GLM 5.2 |
glm-5.2-fp4 |
1M |
$1.12 |
$4.40 |
| Kimi K3 |
kimi-k3 |
1M |
$3.00 |
$15.00 |
| GPT-OSS 120B |
gpt-oss-120b |
128K |
$0.12 |
$0.60 |
Cached input tokens are always free.
Notes
- Why the Responses API matters: Codex requires a provider that implements
/v1/responses, not just /v1/chat/completions. Many OpenAI-compatible
endpoints only expose Chat Completions and need a gateway like LiteLLM in
between; CoralBricks implements Responses directly, so you skip that step.
- Reasoning shows up in Codex. GLM 5.2 and Kimi K3 emit reasoning, which
Codex renders inline — useful for watching an agent plan a multi-step change.
- Long context is the point: GLM 5.2 and Kimi K3 accept up to 1M tokens, so
large-repo Codex sessions fit without truncation.
- The same key works in OpenCode, Cline,
Cursor, GitHub Copilot, and anything else
that speaks OpenAI-compatible providers. See the API reference for
the full surface.