OpenCode 2
Use OpenCode 2 with Divyam for file edits and shell commands.
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. Install OpenCode 2
Follow the official installation instructions.
Set your key in the shell you will use to start the app:
export DIVYAM_API_KEY="divyam-sw-v1-..."
2. Configure Divyam
Model ID: divyam-as/gpt-6-sol. Context window: 1,050,000 tokens. Models and pricing
Merge this into ~/.config/opencode/opencode.json, creating the directory and file if needed. This uses OpenCode 2's custom provider configuration.
The model entry below registers the model and sets its output limit for this custom provider.
{
"providers": {
"divyam": {
"env": ["DIVYAM_API_KEY"],
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://api.preview.divyam.ai/v1"
},
"models": {
"divyam-as/gpt-6-sol": {
"limit": {
"output": 8192
}
}
}
}
}
}
3. Send your first prompt
Start OpenCode from the shell where you exported the key:
opencode --standalone
In OpenCode, run /models and choose divyam/divyam-as/gpt-6-sol before sending your first prompt.
Hello, what are your capabilities?
Divyam can omit the final finish_reason on capped streaming replies, which can leave OpenCode waiting or retrying. Keep the 8192-token output limit shown above.
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.