Skip to content

fix(llm): allow unlisted OpenRouter model overrides - #1610

Open
Dante-dan wants to merge 2 commits into
alibaba:mainfrom
Dante-dan:fix/1609-openrouter-model-override
Open

Dante-dan wants to merge 2 commits into
alibaba:mainfrom
Dante-dan:fix/1609-openrouter-model-override

Conversation

@Dante-dan

Copy link
Copy Markdown

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

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally (race enabled; Go 1.25.5, macOS arm64)
  • Manual testing (describe below)

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/llm produced no catalog changes; make check, make build, and git diff --check passed. No live OpenRouter request was made. The required ocr review --audience agent command was attempted with the locally built CLI but could not resolve an LLM endpoint because none is configured in this environment.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

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.

@CLAassistant

CLAassistant commented Sep 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

🔍 OpenCodeReview found 2 issue(s) in this PR.

  • ✅ Successfully posted inline: 2 comment(s)

Comment thread internal/llm/providers.go
Protocol: ProtocolOpenAIChatCompletions,
BaseURL: "https://openrouter.ai/api/v1",
EnvVar: "OPENROUTER_API_KEY",
OpenModelList: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documentation · high
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.

Comment thread internal/llm/providers.go
Protocol: ProtocolOpenAIChatCompletions,
BaseURL: "https://openrouter.ai/api/v1",
EnvVar: "OPENROUTER_API_KEY",
OpenModelList: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test · medium
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 Qiyuanqiii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@Dante-dan

Copy link
Copy Markdown
Author

done

@Qiyuanqiii Qiyuanqiii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow any OpenRouter model ID in --model for the built-in openrouter provider

3 participants