GUIDE · CODEX CLI
Use Codex CLI with 88Z.ai
The config.toml below follows the official Codex docs. One protocol difference matters: Codex currently speaks /v1/responses, while 88Z.ai serves OpenAI-compatible /v1/chat/completions. The supported path is a one-click CC Switch import with apiFormat=openai_chat, which translates locally.
Create an API key and top up
Sign in, create a key under Workspace → API keys (shown once), optionally set a point cap on that key, then top up in the wallet.
Test the key with curl
Confirm the key can call Chat Completions. A JSON reply with text in choices means it works.
curl https://api.88z.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_88Z_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"openai/gpt-6.2-sol","messages":[{"role":"user","content":"ping"}],"max_completion_tokens":32}'Install CC Switch and import 88Z
Recommended path: install CC Switch (v4.0.10 or later), then click “Import for Codex” under the new key in the workspace. The browser opens a
ccswitch://v1/importlink; confirm it. LeaveapiFormat=openai_chatandendpoint=https://api.88z.ai/v1unchanged.Or write ~/.codex/config.toml
If you only want the official file format first, put it in user-level
~/.codex/config.toml(not a project.codex/config.toml; Codex ignores provider settings there). Do not put the key in the file; use an environment variable:model_provider = "88z" model = "openai/gpt-6.2-sol" [model_providers.88z] name = "88Z.ai" base_url = "https://api.88z.ai/v1" env_key = "EIGHTYEIGHTZ_API_KEY"export EIGHTYEIGHTZ_API_KEY=YOUR_88Z_API_KEY codexOfficial docs mark
experimental_bearer_tokenin the file as discouraged. The workspace still offers it for local, temporary use. Used alone, this config.toml still makes Codex call /v1/responses, which will not work here yet.
Why CC Switch is needed
The official Codex reference says a custom provider’s wire_api only supports responses. With apiFormat=openai_chat, CC Switch translates requests to Chat Completions — the reliable way to use 88Z.ai today.
Common errors
| Error | Cause | Fix |
|---|---|---|
401 invalid_api_key | The key is wrong, deleted, or has extra spaces | Copy the key again from the workspace; check for stray spaces or line breaks. |
402 insufficient_points | Balance is too low to reserve this request | Top up and retry, or use a cheaper model or a lower max output. |
402 key_quota_exceeded | This API key has reached the point cap you set | Raise that key’s point cap in the workspace, or use another key. |
400 unsupported_model | The model name is not callable here | Use an ID from /v1/models or the catalogue, e.g. anthropic/claude-sonnet-5.5. |
400 invalid_output_limit | Max output is above the per-request cap | Set max output to 32,768 or less. |
413 input_too_large | The request text is above the cap | Trim context or start a new conversation (cap: 512 KiB, 128 messages). |
429 upstream_rate_limited | The model service is rate-limiting | Wait for Retry-After, or switch model for now. |
404 /v1/responses | Codex called the Responses API on this site | This site serves /v1/chat/completions, not /v1/responses. Use “Import for Codex” in the workspace, with apiFormat=openai_chat. |