Codex CLI
Who it’s for
Section titled “Who it’s for”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.
Prerequisites
Section titled “Prerequisites”- Codex CLI installed
- A GlideflowAI API key
Get your API key
Section titled “Get your API key”Create a key in the GlideflowAI dashboard.
Base URL
Section titled “Base URL”Use https://api.glideflowai.com/v1.
Model ID
Section titled “Model ID”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.
Minimal working config
Section titled “Minimal working config”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:
export GLIDEFLOW_API_KEY="sk-your-key"codexTest it
Section titled “Test it”Start Codex and ask it to answer with OK. To test the key separately from Codex:
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}'Common errors
Section titled “Common errors”- The top-level
model_provider = "glideflowai"is required. Without it, Codex silently sends requests toapi.openai.cominstead 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.
Notes / limitations
Section titled “Notes / limitations”Reasoning models (GLM, Qwen) spend part of their budget thinking, so give the first request room if you cap output tokens.