openrouter model syntax is not supported #1359

Closed
opened 2026-02-16 17:30:36 -05:00 by yindo · 7 comments
Owner

Originally created by @ilkerhk on GitHub (Aug 18, 2025).

Originally assigned to: @rekram1-node on GitHub.

Hello,
The model commandline argument is misleading when used with openrouters model syntax using preset.

For example below command just starts and continues working with the last used model and but it doesnt give any error or message to the user that it is not using the model requested :

opencode --model openrouter/qwen/qwen3-coder@preset/fp8-and-higher

I think it should give error, or even better just use whatever the user gave as the model in api calls.

Originally created by @ilkerhk on GitHub (Aug 18, 2025). Originally assigned to: @rekram1-node on GitHub. Hello, The model commandline argument is misleading when used with openrouters model syntax using preset. For example below command just starts and continues working with the last used model and but it doesnt give any error or message to the user that it is not using the model requested : opencode --model openrouter/qwen/qwen3-coder@preset/fp8-and-higher I think it should give error, or even better just use whatever the user gave as the model in api calls.
yindo closed this issue 2026-02-16 17:30:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 18, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1439: [feature request] support openrouter presets - This was a closed feature request for similar OpenRouter preset syntax support
  • #1038: Support openrouter shortcut - Related to OpenRouter syntax recognition issues with shortcuts like :nitro
  • #749: Bug: opencode crashes when using OpenRouter models with a colon (:) in their identifier - Related to parsing issues with special characters in model identifiers

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Aug 18, 2025): This issue might be a duplicate of existing issues. Please check: - #1439: [feature request] support openrouter presets - This was a closed feature request for similar OpenRouter preset syntax support - #1038: Support openrouter shortcut - Related to OpenRouter syntax recognition issues with shortcuts like `:nitro` - #749: Bug: opencode crashes when using OpenRouter models with a colon (:) in their identifier - Related to parsing issues with special characters in model identifiers Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Aug 18, 2025):

@ilkerhk just fyi to use a model you need to prefix with the provider, if you are using openrouter this would be:

openrouter/qwen/qwen3-coder@preset/fp8-and-higher

@rekram1-node commented on GitHub (Aug 18, 2025): @ilkerhk just fyi to use a model you need to prefix with the provider, if you are using openrouter this would be: openrouter/qwen/qwen3-coder@preset/fp8-and-higher
Author
Owner

@ilkerhk commented on GitHub (Aug 18, 2025):

@ilkerhk just fyi to use a model you need to prefix with the provider, if you are using openrouter this would be:

openrouter/qwen/qwen3-coder@preset/fp8-and-higher

Yes, I am using with provider name. That was a typo in the message, now corrected. Thanks for noticing.

@ilkerhk commented on GitHub (Aug 18, 2025): > [@ilkerhk](https://github.com/ilkerhk) just fyi to use a model you need to prefix with the provider, if you are using openrouter this would be: > > openrouter/qwen/qwen3-coder@preset/fp8-and-higher Yes, I am using with provider name. That was a typo in the message, now corrected. Thanks for noticing.
Author
Owner

@rekram1-node commented on GitHub (Aug 18, 2025):

Ahh okay I think the issue here is we need to either:

  1. add this model to models.dev
  2. add this model in your opencode config

I will work on adding it to models.dev for ya

@rekram1-node commented on GitHub (Aug 18, 2025): Ahh okay I think the issue here is we need to either: 1. add this model to [models.dev](https://github.com/sst/models.dev) 2. add this model in your opencode config I will work on adding it to models.dev for ya
Author
Owner

@ilkerhk commented on GitHub (Aug 18, 2025):

Ahh okay I think the issue here is we need to either:

  1. add this model to models.dev
  2. add this model in your opencode config

I will work on adding it to models.dev for ya

Thank you @rekram1-node
fp8-and-higher is a preset that I defined. Others might have different and multiple presets so might not be convenient to update config for each model. But I've realized it is possible to use env variables in config,

Using suggestion of @michabbb in https://github.com/sst/opencode/issues/1439
somewhat indirect way but below seems to be a workaround

"provider": {
                "openrouterCustom": {
                        "npm": "@ai-sdk/openai-compatible",
                        "options": {
                                "baseURL": "{env:OPENAI_BASE_URL}",
        								  "apiKey": "{env:OPENAI_API_KEY}"
                        },
                        "models": {
										  "{env:OPENAI_MODEL}": {}
                        }
                }
        }

With above unspecified provider/model/url in opencode.json now it is possible to use it with any name :

export OPENAI_API_KEY="sk-XXXX"
export OPENAI_BASE_URL="https://openrouter.ai/api/v1"
export OPENAI_MODEL="qwen/qwen3-coder@preset/fp8-and-higher"

opencode --model openrouterCustom/$OPENAI_MODEL
@ilkerhk commented on GitHub (Aug 18, 2025): > Ahh okay I think the issue here is we need to either: > > 1. add this model to [models.dev](https://github.com/sst/models.dev) > 2. add this model in your opencode config > > I will work on adding it to models.dev for ya Thank you @rekram1-node fp8-and-higher is a preset that I defined. Others might have different and multiple presets so might not be convenient to update config for each model. But I've realized it is possible to use env variables in config, Using suggestion of @michabbb in https://github.com/sst/opencode/issues/1439 somewhat indirect way but below seems to be a workaround ``` "provider": { "openrouterCustom": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "{env:OPENAI_BASE_URL}", "apiKey": "{env:OPENAI_API_KEY}" }, "models": { "{env:OPENAI_MODEL}": {} } } } ``` With above unspecified provider/model/url in opencode.json now it is possible to use it with any name : ``` export OPENAI_API_KEY="sk-XXXX" export OPENAI_BASE_URL="https://openrouter.ai/api/v1" export OPENAI_MODEL="qwen/qwen3-coder@preset/fp8-and-higher" opencode --model openrouterCustom/$OPENAI_MODEL ```
Author
Owner

@rekram1-node commented on GitHub (Aug 18, 2025):

Ahh that makes sense, I don't use openrouter so I was unfamiliar with the @preset syntax. I completely agree this would be inconvenient to add to models.dev then haha

@rekram1-node commented on GitHub (Aug 18, 2025): Ahh that makes sense, I don't use openrouter so I was unfamiliar with the @preset syntax. I completely agree this would be inconvenient to add to models.dev then haha
Author
Owner

@rekram1-node commented on GitHub (Aug 18, 2025):

Going to close as this is possible using custom config.

@rekram1-node commented on GitHub (Aug 18, 2025): Going to close as this is possible using custom config.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1359