Using OpenAI Codex CLI with NovAI: 45 Chinese Coding Models, One Key

Codex CLI speaks any OpenAI-compatible provider. Here is the exact config.toml to route it through NovAI — with verified Responses API support and real per-token prices.

OpenAI's Codex CLI is no longer locked to OpenAI's own models. Its model_providers config accepts any OpenAI-compatible endpoint — which means you can run your coding agent on DeepSeek V4, Kimi K2.7-Code, GLM-5.3 or Qwen3.7-Max and switch between them without touching code.

NovAI (aiapi-pro.com) exposes 45 models behind one OpenAI-compatible key, including both the Chat Completions API and the Responses API that Codex prefers. Every claim below was verified against the live endpoint on 2026-09-01.

What you need

Step 1 — export the key

export NOVAI_API_KEY=nvai-your-key-here

Step 2 — add NovAI to ~/.codex/config.toml

model = "deepseek-v4-pro"
model_provider = "novai"

[model_providers.novai]
name = "NovAI"
base_url = "https://aiapi-pro.com/v1"
env_key = "NOVAI_API_KEY"
wire_api = "responses"   # Codex's native wire format — verified working
Verified 2026-09-01: POST https://aiapi-pro.com/v1/responses returns a completed response object (reasoning summaries included), streaming works on /v1/chat/completions with stream: true, and function calling returns proper tool_calls. If you hit a client that doesn't support the Responses wire format, set wire_api = "chat" instead.

Step 3 — run codex and switch models

cd your-repo
codex                  # requests now route through NovAI
# inside a session:
/model kimi-k2.7-code  # switch models on the fly

Which model to run Codex on (real prices, verified Sep 2026)

All prices below are copied from the live pricing page — per 1M tokens, input / output:

ModelIn / Out per 1MContextBest for
kimi-k2.7-code$0.67 / $3.40Everyday coding agent runs — best value
deepseek-v4-pro$0.57 / $1.151MLarge repos, long planning chains
doubao-seed-2.0-code$0.448 / $2.24Budget coding tasks
glm-5.3$1.25 / $4.001MHard reasoning, agentic tool chains
qwen3.7-max$1.16 / $3.475General coding + bilingual repos
kimi-k3$2.90 / $14.501MLong-horizon agents, stuck-task escalation
deepseek-v4-flash$0.08 / $0.171MTriage, quick reads, sub-agents

A practical pattern: let Codex do exploration and small fixes on deepseek-v4-flash (8 cents per million input tokens), escalate real feature work to kimi-k2.7-code or deepseek-v4-pro, and only burn kimi-k3 on tasks the cheaper models fail twice.

Why this matters for cost

Coding agents are token-hungry: every turn ships file contents and diffs back and forth, and a single long session can consume millions of tokens. At those volumes the per-token spread between models is the whole bill. Keeping exploration on sub-$0.10/M models and reserving premium models for decisions is the single biggest lever — no config gymnastics required, just the /model command.

FAQ

Does Codex's tool use work through NovAI?

Yes. We verified function calling end-to-end: a tools-schema request to /v1/chat/completions returned a well-formed tool_calls payload with finish_reason: tool_calls.

Do I need a Chinese phone number or payment method?

No. NovAI sits between you and the upstream vendors; you register with email and pay by card or crypto on our dashboard.

Does the free trial cover a real Codex session?

The $2 trial credit is enough for meaningful evaluation on the cheaper models — e.g. roughly 20M+ input tokens on deepseek-v4-flash.

Anything that doesn't work?

Image and video generation models on NovAI carry a mandatory "AI-generated" watermark under Chinese regulation. Text and code models — everything relevant to Codex — are unaffected. See the watermark notice.

Wire Codex to 45 models in two minutes

One OpenAI-compatible key for DeepSeek, Kimi, GLM, Qwen, MiniMax and Doubao. Prepaid balance, no subscription, zero platform fee. $2 trial credit on signup.

Start Free →
Zhipu AI Ecosystem Partner Volcano Engine Ecosystem Partner Tencent Cloud Ecosystem Partner