All guides / Coding assistants
Use XHuoAPI in Codex CLI
Codex CLI lets you add a custom model provider in its config file. It only talks to OpenAI's Responses endpoint (/v1/responses), so through XHuoAPI the models that work are GPT models. We ran real file-writing tasks with codex-cli 0.156.1, and the config below is the one we tested.
Before you start
- Sign up in the console and create an API token. Registration needs an email address only, no phone number.
- You pick a tier when creating the token; new accounts default to Standard. The tier sets price and stability and also which models are available — see the pricing page.
Verify first
Before touching the tool, confirm the key and model work with curl. This rules out half of the 'I configured it and nothing happens' cases.
curl https://api.xhuoapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v3.2","messages":[{"role":"user","content":"ping"}]}'
Steps
Install Codex CLI.
npm install -g @openai/codex
Edit ~/.codex/config.toml (create it if it doesn't exist) and add the following. wire_api must be responses.
model = "gpt-5.5" model_provider = "xhuoapi" [model_providers.xhuoapi] name = "XHuoAPI" base_url = "https://api.xhuoapi.ai/v1" env_key = "XHUO_API_KEY" wire_api = "responses"
Put your API key in the environment variable named by env_key.
export XHUO_API_KEY=YOUR_XHUOAPI_KEY
Run codex in your project directory for interactive mode, or codex exec for a one-off task. Use -m to switch models for a single run.
codex exec -m gpt-5.4 "Explain what this repository does"
Notes
Commonly used models
These are common choices for this kind of tool; click a model to see its price in each tier. The full list is on the pricing page.
Steps follow the tool's current official documentation; the UI may change after updates. Tell us if something no longer matches.