Support openrouter shortcut #744

Closed
opened 2026-02-16 17:28:06 -05:00 by yindo · 3 comments
Owner

Originally created by @kkpattern on GitHub (Jul 15, 2025).

Originally assigned to: @thdxr on GitHub.

Currently, 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.

Originally created by @kkpattern on GitHub (Jul 15, 2025). Originally assigned to: @thdxr on GitHub. Currently, opencode doesn't support shortcut. Given the following config: ```json { "$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](https://openrouter.ai/docs/features/provider-routing#nitro-shortcut) to sort all openrouter providers by throughput. It would be nice if opencode can support it.
yindo closed this issue 2026-02-16 17:28:06 -05:00
Author
Owner

@backkem commented on GitHub (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)

@backkem commented on GitHub (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`:** ```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)
Author
Owner

@drewbitt commented on GitHub (Jul 17, 2025):

Related https://github.com/sst/opencode/issues/749

@drewbitt commented on GitHub (Jul 17, 2025): Related https://github.com/sst/opencode/issues/749
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#744