GeezerVison is showing github.com — Support openrouter shortcut · Issue #1038 · anomalyco/opencode
Support openrouter shortcut #1038DescriptionCurrently, opencode doesn't support shortcut. Given the following config:
{
"$schema": "https://opencode.ai/config.json",
"model": "openrouter/moonshotai/kimi-k2:nitro"
}
opencode won't recognize the model and will fallback to other models. The :nitro is a openrouter shortcut to sort all openrouter providers by throughput.
It would be nice if opencode can support it. Reacted by Gavin Fuller, Michiel De Backker, wienans, Guilherme Tabuada, Marcel Bochtler, Florian Herrengt, Ralf Stephan, pixlguru, Lucas Arthur Felgueiras, stefanof-sevio and 1 more Activitybackkem commented on Jul 16, 2025 You can work around this by creating a custom provider configuration. Here's how to set it up:
1. Configure the provider in your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openrouter-shortcut": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://openrouter.ai/api/v1"
},
"models": {
"moonshotai/kimi-k2:nitro": {
"id": "moonshotai/kimi-k2:nitro",
"name": "Kimi K2 Nitro",
"attachment": false,
"reasoning": true,
"temperature": true,
"tool_call": true,
"limit": {
"context": 200000,
"output": 4096
}
}
}
}
}
}
2. Configure authentication:
Run opencode auth login and choose "Custom Provider" to set up your OpenRouter API key for the openrouter-shortcut provider.
This approach lets you use OpenRouter shortcuts until native support is added.
--posted from claude code MCP (until my opencode is fully configured) Reacted by Florian Herrengt and Philipp Gillé drewbitt commented on Jul 17, 2025 rekram1-node commented on Dec 28, 2025 [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this! philippgille commented on Apr 26, 2026 This is still not officially supported, right? Or am I doing something wrong?
Thanks backkem for the workaround! But it seems you don't even need the custom provider. The following works:
"provider": {
"openrouter": {
"models": {
"moonshotai/kimi-k2.6": {
"id": "moonshotai/kimi-k2.6:nitro",
"name": "Kimi K2.6 Nitro"
}
}
}
},
And regular OpenRouter auth config.
You can then either select that model interactively via /model command and select "Kimi K2.6 Nitro", or put "model": "openrouter/moonshotai/kimi-k2.6" into the config (root level). Reacted by Wei Zhu and Alex Kosh tavurth commented on Jul 22, 2026 Reacted by Gary Moon, Matt Reid and ian garymoon commented on Jul 29, 2026 This feels like a particularly useful thing to have in OpenCode. Depending on which model you select, the standard (non-nitro) response times can be unworkably slow.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|