Skip to content

Codex CLI

Terminal users who want OpenAI’s Codex CLI agent to run on GlideflowAI models — for example glm-5.2 for coding at a fraction of frontier pricing.

  • Codex CLI installed
  • A GlideflowAI API key

Create a key in the GlideflowAI dashboard.

Use https://api.glideflowai.com/v1.

Any model works. Copy an exact ID from the models page — for example glm-5.2, qwen3.7-max-2026-06-08, or kimi-k2.7-code.

Add this to ~/.codex/config.toml:

model = "glm-5.2"
model_provider = "glideflowai"
[model_providers.glideflowai]
name = "GlideflowAI"
base_url = "https://api.glideflowai.com/v1"
env_key = "GLIDEFLOW_API_KEY"

Then run:

Terminal window
export GLIDEFLOW_API_KEY="sk-your-key"
codex

Start Codex and ask it to answer with OK. To test the key separately from Codex:

Terminal window
curl https://api.glideflowai.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.2","messages":[{"role":"user","content":"Say OK"}],"max_tokens":512}'
  • The top-level model_provider = "glideflowai" is required. Without it, Codex silently sends requests to api.openai.com instead of GlideflowAI.
  • Do not set wire_api. It was removed in codex-cli 0.144.1; the default is correct.
  • HTTP 503 with 无可用渠道 means the model ID is wrong or unavailable for your key — copy an exact ID from the models page.

Reasoning models (GLM, Qwen) spend part of their budget thinking, so give the first request room if you cap output tokens.