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.

Reviewed 2026-11-26 · Based on the Codex configuration reference and the CC Switch import guide

  1. 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.

  2. Test the key with curl

    Confirm the key can call Chat Completions. A JSON reply with text in choices means it works.

    curl

    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}'
  3. 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/import link; confirm it. Leave apiFormat=openai_chat and endpoint=https://api.88z.ai/v1 unchanged.

  4. 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:

    ~/.codex/config.toml

    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"
    

    macOS / Linux

    export EIGHTYEIGHTZ_API_KEY=YOUR_88Z_API_KEY
    codex

    Official docs mark experimental_bearer_token in 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

ErrorCauseFix
401 invalid_api_keyThe key is wrong, deleted, or has extra spacesCopy the key again from the workspace; check for stray spaces or line breaks.
402 insufficient_pointsBalance is too low to reserve this requestTop up and retry, or use a cheaper model or a lower max output.
402 key_quota_exceededThis API key has reached the point cap you setRaise that key’s point cap in the workspace, or use another key.
400 unsupported_modelThe model name is not callable hereUse an ID from /v1/models or the catalogue, e.g. anthropic/claude-sonnet-5.5.
400 invalid_output_limitMax output is above the per-request capSet max output to 32,768 or less.
413 input_too_largeThe request text is above the capTrim context or start a new conversation (cap: 512 KiB, 128 messages).
429 upstream_rate_limitedThe model service is rate-limitingWait for Retry-After, or switch model for now.
404 /v1/responsesCodex called the Responses API on this siteThis site serves /v1/chat/completions, not /v1/responses. Use “Import for Codex” in the workspace, with apiFormat=openai_chat.

Related