Skip to content

Support openrouter shortcut #1038

Closed
Closed

Description

@kkpattern

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.

Activity

  1. backkem commented on Jul 16, 2025

    @backkem

    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)

  2. self-assigned this
    on Jul 16, 2025
  3. drewbitt commented on Jul 17, 2025

    @drewbitt

    Related #749

  4. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

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

  5. philippgille commented on Apr 26, 2026

    @philippgille

    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).

  6. tavurth commented on Jul 22, 2026

    @tavurth

    Can we reopen this? @rekram1-node

  7. garymoon commented on Jul 29, 2026

    @garymoon

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions