ZCode Agent CLI
You need a Divyam account and an API key. If you don't have them yet, follow Getting Started first.
Replace the shortened divyam-sw-v1-... shown in examples with your complete API key.
The examples use divyam-as/gpt-6-sol. For another model, select its current ID in your harness or copy it from Models and pricing, and check its context limit and supported features.
1. Build the Agent CLI
Build the Node.js bundle using the official ZCode Agent CLI instructions. Keep its generated resources beside the bundle. Before continuing, replace /absolute/path/to/ZCode below with your source checkout’s absolute path:
export ZCODE_CLI="/absolute/path/to/ZCode/apps/zcode-cli/packages/cli/dist/zcode.cjs"
2. Save your Divyam connection
Model ID: divyam-as/gpt-6-sol. Context window: 1,050,000 tokens. Models and pricing
Save this personal provider configuration as ~/.zcode/v2/provider_config.json. Replace divyam-sw-v1-... with your Divyam key. If the file exists, merge the Divyam provider, model rule and default selection into it while keeping your other providers:
{
"schemaVersion": 1,
"config": {
"providerConfigRules": {
"providerRules": [{
"providerId": "divyam",
"config": {
"group": "standard-personal",
"access": {"type": "api-key", "apiKey": "divyam-sw-v1-..."},
"api": {"type": "openai-chat-completions", "baseUrl": "https://api.preview.divyam.ai/v1"},
"personalModelIds": ["divyam-as/gpt-6-sol"]
}
}]
},
"modelConfigRules": {
"providerModelRules": [{
"providerId": "divyam",
"modelId": "divyam-as/gpt-6-sol",
"config": {
"properties": {"contextWindow": 200000},
"optionSpecs": {"maxOutputTokens": {"max": 8192}}
}
}],
"manualProviderModelRules": []
},
"defaultModelSelection": {
"providerId": "divyam",
"modelId": "divyam-as/gpt-6-sol",
"options": {"reasoningLevel": "disabled"}
}
}
}
This CLI connection uses your Divyam key without a Z.ai account login.
3. Start an interactive session
From your project folder and the terminal where you set ZCODE_CLI, run:
node "$ZCODE_CLI"
ZCode’s default Build mode keeps normal tool approvals.
Hello, what are your capabilities?
For an image-capable model, add "inputFormat": { "supportsImage": true } inside the matching model rule's config.properties in ~/.zcode/v2/provider_config.json. This enables image attachments and image reads. Use /compact to shorten the current conversation.
Desktop and web use, browsing and automatic context-limit handling are outside this guide.
Check your requests
Open the Divyam console and select Logs. Your requests appear there within a few seconds, newest first, with their status, token counts and latency. Usage and Credits & Billing catch up within a few minutes.
Some clients display zero when model prices are missing. Check Credits & Billing for Divyam charges. Local dollar limits depend on the client's price and usage data.
For filters, cached-token counts and the requested-versus-routed view, see Logs and usage.