feat: add OpenRouter free-only model discovery#413
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Warning Review limit reached
Next review available in: 54 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (24)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23c47671bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const selectedSubset = selectedModels.length > 0 && selectedModels.length < discoveredModels.length | ||
| ? selectedModels | ||
| : undefined; |
There was a problem hiding this comment.
Persist the OpenRouter free-only allowlist
When the user enables the new OpenRouter free-only filter, discoveredModels is already the filtered free set, so selecting all visible rows makes this expression store no selectedModels at all. After save, the server enriches the OpenRouter provider and live discovery exposes the full upstream catalog, including paid models, despite the user choosing “free only”; persist the selected list whenever the free-only filter is active.
Useful? React with 👍 / 👎.
| baseUrlChoices: [ | ||
| { id: "china-mainland", label: "China mainland", baseUrl: "https://api.siliconflow.cn/v1" }, | ||
| { id: "international", label: "International", baseUrl: "https://api.siliconflow.com/v1" }, | ||
| ], |
There was a problem hiding this comment.
Allow SiliconFlow's selected endpoint at routing time
The new International endpoint can be selected and even discovered here, but the registry entry still lacks allowBaseUrlOverride: true; routedProviderConfig ignores saved non-template base URLs for registry providers unless that flag is set, so chat traffic for a provider saved with https://api.siliconflow.com/v1 is silently routed back to the China endpoint. Add the override flag or otherwise make these official choices honored by the router.
Useful? React with 👍 / 👎.
| const rawId = typeof item.id === "string" ? item.id | ||
| : typeof item.name === "string" ? item.name | ||
| : typeof item.model === "string" ? item.model | ||
| : ""; |
There was a problem hiding this comment.
Filter non-generative Google models from the catalog
For Google AI Studio's { models: [...] } response, accepting every row with a name also publishes embedding-only entries such as text-embedding-004, because the parser ignores supportedGenerationMethods. Those rows are not callable through the Google chat/generateContent adapter and will fail when selected in Codex, so the Google models envelope needs to keep only generative rows before adding them to the catalog.
Useful? React with 👍 / 👎.
| const provider = { | ||
| ...providerConfigSeed(entry), | ||
| ...(suppliedBaseUrl ? { baseUrl: suppliedBaseUrl } : {}), | ||
| ...(supplied.apiKey ? { apiKey: supplied.apiKey } : {}), |
There was a problem hiding this comment.
Preserve key auth during preset discovery
When a user selects an OAuth preset that exposes “Use API key instead” (for example xAI) and then clicks Discover models, this rebuilds the probe config from the registry seed, which restores authMode: "oauth" and copies only the entered key. resolveModelsAuthToken then ignores that key and uses an existing OAuth credential or no credential, so the discovered/fallback model list can differ from the provider that will be saved with key auth; carry the supplied key auth mode when probing these presets.
Useful? React with 👍 / 👎.
| const invalidateDiscoveryRequest = () => { | ||
| discoveryRequestRef.current += 1; | ||
| discoveryAbortRef.current?.abort(); | ||
| discoveryAbortRef.current = null; | ||
| setDiscoveryBusy(false); | ||
| }; |
There was a problem hiding this comment.
Clear stale discovered models after form changes
After a successful discovery, changing the endpoint, base URL, adapter, key, or private-network toggle only aborts the in-flight request and clears the busy flag, leaving the previous discoveredModels and selectedModels visible. If the user then saves without re-running discovery, those old model IDs are persisted for the new provider configuration, which can hide the correct catalog or set an unavailable default; clear the discovery source/list/selection whenever the probe input is invalidated.
Useful? React with 👍 / 👎.
Summary
Dependencies
This PR depends on the provider directory, provider discovery, and provider model loader PRs being merged first.
Validation