Repository navigation
fix(llm): allow unlisted OpenRouter model overrides - #1610
Conversation
|
🔍 OpenCodeReview found 2 issue(s) in this PR.
|
| Protocol: ProtocolOpenAIChatCompletions, | ||
| BaseURL: "https://openrouter.ai/api/v1", | ||
| EnvVar: "OPENROUTER_API_KEY", | ||
| OpenModelList: true, |
There was a problem hiding this comment.
Documentation sync required. Per project rules, any modification of a provider entry must be accompanied by updates to the built-in provider table in all four documentation files (en/configuration.md, zh/configuration.md, ja/configuration.md, ru/configuration.md). The docs currently list OpenRouter without mentioning that its model list is non-gating (open catalog). Please update all four docs to reflect this behavioral difference.
| Protocol: ProtocolOpenAIChatCompletions, | ||
| BaseURL: "https://openrouter.ai/api/v1", | ||
| EnvVar: "OPENROUTER_API_KEY", | ||
| OpenModelList: true, |
There was a problem hiding this comment.
Missing test coverage for new field. The existing TestLookupProvider_OpenRouterDetails test verifies Protocol, BaseURL, and EnvVar but does not assert OpenModelList == true. Since this new field changes resolver behavior (disabling model-list gating), add an assertion like if !p.OpenModelList { t.Error("expected OpenModelList to be true") } to prevent accidental regression.
Qiyuanqiii
left a comment
There was a problem hiding this comment.
We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
|
done |
Qiyuanqiii
left a comment
There was a problem hiding this comment.
Re-reviewed 3a63e3e.
The OpenRouter override change is appropriately scoped: its preset/configured model entries remain picker suggestions, while unlisted per-run IDs can reach the provider. Closed-list presets retain their validation, and the existing ambient-auth exception is preserved.
The earlier bot requests are addressed in this revision: the OpenRouter preset flag has a direct assertion, the resolver test covers an unlisted model alongside configured suggestions, and the four provider-table documentation pages have been updated.
I found no code-level blocker.
|
@Qiyuanqiii @Dante-dan If valid models ID are not in the default registry, you either
or
ocr config set provider anthropic
ocr config set model claude-opus-4-6
ocr config set providers.anthropic.api_key sk-ant-xxxxxxxxxxNote that the existance check is enforced by default. There is no way to bypass it. cc @moltar |
|
That's just too many steps to do something simple. It worked, and still works, perfectly fine with a custom provider configured to use OpenRouter. And I can pass any model via --model flag. Switching to an official provider once it was released was a downgrade in my experience. That's why I raised this feature request. |
This comment was marked as outdated.
This comment was marked as outdated.
| Protocol: ProtocolOpenAIChatCompletions, | ||
| BaseURL: "https://openrouter.ai/api/v1", | ||
| EnvVar: "OPENROUTER_API_KEY", | ||
| OpenModelList: true, |
There was a problem hiding this comment.
Is this only effective to Open router?
There was a problem hiding this comment.
From my understanding, OpenRouter is just a example. The issue means "Get rid of the validation check and allow any input from --model flag. If you have a different understanding, let me know.
Could you please explain why? What's the benefit of this validator? |
|
I previously thought that this validator keeps out invalid models, it is also designed to keep out outdated models that does not have enough agentic abilities. Generally most models are included in that list. If you want to bypass that ruleset than you have to manual configure a model through As I said here, I will not block anyone. If you have confusion, feel free to ask. If you disagree, ignoring my opinion is totally fine. By the way, take a look at this: #1610 (comment) Do you mean you want to get rid of all constrained items, not only for Open router but also for other providers as well? |
|
I didn't mean that as I didn't get stuck on any other option. Models get released all the time I think it's unrealistic to keep up with any kind of list. Perhaps, at best, there can be a deprecated model list that simply warns user of using an older model. That's the main reason I just want to pass models available on OR thru --model. I have a skill that uses ocr to do reviews. Many engineers may have different versions of ocr on their machines and have configured different models. The skill instructs using specific models. If user doesn't have those in models array then --model fails to work. So we have to now tell all users to update their ocr config. |
|
@Dante-dan The docs are currently inconsistent across the five locales (en, zh, ja, ko, ru). Could you either (1) remove the |
|
@Dante-dan Thanks for putting this together. The per-run OpenRouter model override is valuable, and I'd like to help get this PR merged sooner. I'll take over the remaining work directly in this PR, including syncing the docs across all five locales, and keep the changes focused. Please let me know if you have any updates in progress so we can avoid conflicts. |
fix(llm): allow unlisted OpenRouter model overrides (alibaba#1610)
fix(llm): allow unlisted OpenRouter model overrides (alibaba#1610)
fix(llm): allow unlisted OpenRouter model overrides (alibaba#1610)
Description
The built-in OpenRouter preset lists a handful of models for
ocr config model. The resolver also treated that list, combined with configured suggestions, as an allowlist for--model, so valid OpenRouter IDs absent from the list failed before a request reached OpenRouter.This change marks OpenRouter's model list as open for per-run overrides. The listed models remain picker suggestions; an unlisted ID passes through for OpenRouter to validate. Closed-list providers and the existing Bedrock exception keep their current behavior. The CLI reference documents the distinction.
Type of Change
How Has This Been Tested?
make testpasses locally (race enabled; Go 1.25.5, macOS arm64)The new resolver test selects the built-in OpenRouter provider with a configured model suggestion and passes an unlisted ID via
--model. Existing tests cover rejection by closed-list providers.go generate ./internal/llmproduced no catalog changes;make check,make build, andgit diff --checkpassed. No live OpenRouter request was made. The requiredocr review --audience agentcommand was attempted with the locally built CLI but could not resolve an LLM endpoint because none is configured in this environment.Checklist
go fmt,go vet)AI/LLM disclosure: Codex using GPT-6 Sol assisted with investigation, implementation, tests, documentation, and this description. A human contributor review and CLA signature are not claimed here.
Related Issues
Closes #1609.