In ~/.pi/agent/models.json, models are defined with explicit contextWindow and maxTokens fields, plus a modelOverrides block for the github-copilot provider:
"modelOverrides": {
"claude-opus-4.6": {
"contextWindow": 192000,
"cost": {
"input": 5,
"output": 25,
"cacheRead": 0.5,
"cacheWrite": 6.25
}
}
}In OpenCode's config (opencode.json or ~/.config/opencode/opencode.json), the provider → models configuration supports the same kind of override. The relevant schema fields are:
limit: {
context: number, // ← context window size
input: number, // optional
output: number
}
For Opus 4.6 via GitHub Copilot, add this to opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"github-copilot": {
"models": {
"claude-opus-4.6": {
"limit": {
"context": 192000,
"output": 64000
},
"cost": {
"input": 5,
"output": 25,
"cache_read": 0.5,
"cache_write": 6.25
}
}
}
}
}
}In packages/opencode/src/provider/provider.ts, when config-defined models are processed inside the state() function, existing models from models.dev are merged with config overrides:
limit: {
context: model.limit?.context ?? existingModel?.limit?.context ?? 0,
output: model.limit?.output ?? existingModel?.limit?.output ?? 0,
},The config value for limit.context takes precedence over whatever models.dev reports. The Config.Provider schema uses ModelsDev.Model.partial(), meaning every field is optional — only the fields you want to override need to be specified.
Besides limit and cost, you can also override:
options— model-specific options likethinking.budgetTokensvariants— custom variant configurationsreasoning— whether the model supports reasoningheaders— custom headers per modelattachment,temperature,tool_call— capability flags
- OpenCode docs: https://opencode.ai/docs/models/
- Config schema:
packages/opencode/src/config/config.ts - Provider/model resolution:
packages/opencode/src/provider/provider.ts - Models.dev schema:
packages/opencode/src/provider/models.ts