Selecting a specific provider with OpenRouter #123

Closed
opened 2026-02-16 17:25:18 -05:00 by yindo · 2 comments
Owner

Originally created by @MartinMikusat on GitHub (Jun 18, 2025).

Originally assigned to: @thdxr on GitHub.

I might be missing something, is it possible to select a specific provider from OpenRouter? I couldn't find any info on this so I searched around, tried a bunch of random stuff but none of this seems to be using Cerebras as the provider (the speed difference should be obvious in their case, that's what I want to try)

{
    "$schema": "https://opencode.ai/config.json",
    "provider": {
        "openrouter": {
            "npm": "@openrouter/ai-sdk-provider",
            "name": "OpenRouter",
            "options": {
                "apiKey": 
            },
            "models": {
                "meta-llama/llama-4-scout:cerebras": {
                    "name": "Llama 4 Scout",
                    "order": [
                        "cerebras"
                    ],
                    "provider": "cerebras"
                }
            }
        }
    }
}
Originally created by @MartinMikusat on GitHub (Jun 18, 2025). Originally assigned to: @thdxr on GitHub. I might be missing something, is it possible to select a specific provider from OpenRouter? I couldn't find any info on this so I searched around, tried a bunch of random stuff but none of this seems to be using Cerebras as the provider (the speed difference should be obvious in their case, that's what I want to try) ``` { "$schema": "https://opencode.ai/config.json", "provider": { "openrouter": { "npm": "@openrouter/ai-sdk-provider", "name": "OpenRouter", "options": { "apiKey": }, "models": { "meta-llama/llama-4-scout:cerebras": { "name": "Llama 4 Scout", "order": [ "cerebras" ], "provider": "cerebras" } } } } } ```
yindo closed this issue 2026-02-16 17:25:18 -05:00
Author
Owner

@thdxr commented on GitHub (Jun 18, 2025):

i wasn't able to find documentation on their ai sdk provider on how to pass this through - do you see anything?

@thdxr commented on GitHub (Jun 18, 2025): i wasn't able to find documentation on their ai sdk provider on how to pass this through - do you see anything?
Author
Owner

@cravenceiling commented on GitHub (Jun 18, 2025):

i wasn't able to find documentation on their ai sdk provider on how to pass this through - do you see anything?

According to this documentation from openrouter, the openrouter provider can be customized using a provider object which must be sent in the request body. Also, the ai-sdk has this documentation about passing extra body options to openrouter.

@cravenceiling commented on GitHub (Jun 18, 2025): > i wasn't able to find documentation on their ai sdk provider on how to pass this through - do you see anything? According to [this documentation](https://openrouter.ai/docs/features/provider-routing) from openrouter, the openrouter provider can be customized using a `provider` object which must be sent in the request body. Also, the ai-sdk has [this documentation](https://github.com/OpenRouterTeam/ai-sdk-provider?tab=readme-ov-file#passing-extra-body-to-openrouter) about passing extra body options to openrouter.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#123