ZCode with AI Gateway
ZCode is Z.ai's desktop agent development environment. Its custom providers speak the OpenAI-compatible Chat Completions format, which you can point at AI Gateway for unified model access and spend monitoring.
Quit ZCode, then run the Vercel CLI setup command:
npx vercel ai-gateway setup --agent zcodeThe command writes a gateway provider and a seeded model list into ~/.zcode/v2/config.json with 0600 permissions. Re-run it to refresh the model list.
If you can't use the Vercel CLI, configure ZCode manually:
Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.
Quit the ZCode desktop app before editing its config. ZCode keeps its provider registry in memory and rewrites
~/.zcode/v2/config.jsonwhen it saves settings or exits, silently discarding edits made while it runs.Add the provider to
~/.zcode/v2/config.jsonunderprovider, with the API format on Chat completions:~/.zcode/v2/config.json{ "provider": { "vercel-ai-gateway": { "name": "Vercel AI Gateway", "kind": "openai-compatible", "options": { "apiKey": "your-ai-gateway-api-key", "baseURL": "https://ai-gateway.vercel.sh/coding-agent/v1", "apiKeyRequired": true }, "source": "custom", "models": { "openai/gpt-6-astra": { "limit": { "context": 1000000, "output": 128000 } } } } } }ZCode has no environment-variable lookup for custom providers, so the key is stored in this file. Create it with mode
0600.Open ZCode and pick a model under Vercel AI Gateway in the chat's model picker. Add more gateway models with Manage models > Add model.
On a fresh install, choose Skip for now on ZCode's welcome screen. Its API-key dropdown only takes Z.ai/BigModel accounts, and the gateway provider lives in Settings > Model settings.
View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details.
- Browse the models catalog for available models
- Configure spend limits on your API key
Was this helpful?