add OpenRouter provider preset - #707
Conversation
|
Hi @kenrogers! 🎉 Thanks for making open-design better! |
lefarcen
left a comment
There was a problem hiding this comment.
Hey @kenrogers! Thanks for adding OpenRouter — this makes BYOK more discoverable. 👍
I've reviewed the config, tests, and docs. The core implementation is solid, but I found a few gaps in test coverage and documentation that would help users avoid setup pitfalls:
Main findings:
- The settings test doesn't actually prove the OpenRouter preset appears in the UI dropdown
- Model IDs may not match the token-limit lookup, which could truncate large artifacts
- Docs don't mention where to get an API key or warn about OpenRouter-specific account/rate-limit errors
See inline comments for details. None of these block merge, but addressing them would strengthen the feature.
| }); | ||
| }); | ||
|
|
||
| it('keeps OpenRouter as a selectable OpenAI-compatible provider preset', () => { |
There was a problem hiding this comment.
P2: This test manually patches baseUrl/model, so it would still pass if OpenRouter were removed from KNOWN_PROVIDERS. Consider asserting the KNOWN_PROVIDERS entry or simulating actual provider selection from the Settings UI to prove discoverability.
| label: 'OpenRouter', | ||
| protocol: 'openai', | ||
| baseUrl: 'https://openrouter.ai/api/v1', | ||
| model: 'openai/gpt-5.2', |
There was a problem hiding this comment.
P2: The model IDs here (openai/gpt-5.2, openrouter/auto, etc.) may not match modelMaxTokensDefault lookup keys in litellm-models.json. If they fall back to 8192, large artifact responses could be truncated. Consider explicit overrides or OpenRouter-aware normalization.
| expect(isOpenAICompatible('mimo-v2.5-pro', 'https://token-plan-cn.xiaomimimo.com/v1')).toBe(true); | ||
| }); | ||
|
|
||
| it('routes OpenRouter through the OpenAI-compatible chat completions proxy', () => { |
There was a problem hiding this comment.
P3: This routing test only covers the isOpenAICompatible heuristic. It doesn't prove the OpenRouter preset actually flows through /api/proxy/openai/stream at runtime. An integration-style provider test using the preset config would catch regressions.
|
|
||
| ### OpenRouter API mode | ||
|
|
||
| OpenRouter uses the OpenAI-compatible API path. In **Settings -> Execution -> API mode**, choose **OpenAI**, pick **OpenRouter** from quick-fill providers, paste an OpenRouter API key, and select a model such as `openai/gpt-5.2` or `openrouter/auto`. |
There was a problem hiding this comment.
P3: Docs don't tell users where to get an OpenRouter API key or that account credits/free-model availability can affect success. New users hitting 401/402/429 won't have enough context to distinguish bad app config from OpenRouter account/rate-limit issues.
|
|
||
| ### OpenRouter API mode | ||
|
|
||
| OpenRouter uses the OpenAI-compatible API path. In **Settings -> Execution -> API mode**, choose **OpenAI**, pick **OpenRouter** from quick-fill providers, paste an OpenRouter API key, and select a model such as `openai/gpt-5.2` or `openrouter/auto`. |
There was a problem hiding this comment.
P3: Missing manual-setup warning: if a user pastes https://openrouter.ai/api/v1 while still on Anthropic/custom protocol, requests could go through the wrong proxy shape and fail. Add a note that protocol must be OpenAI.
|
@kenrogers — checking in on the OpenRouter preset PR. It's been about 4 days since lefarcen left feedback and we're holding for your next iteration. Still in flight? Drop a comment if something in the review thread needs clarification, or let us know if you'd like to close this in favor of another approach. (Tagged |
|
Thanks for the review. I pushed
Validation passed locally: web tests, web typecheck, |
Why
OpenRouter already works through Open Design's OpenAI-compatible proxy when users know the custom base URL, but it was not available as a quick-fill provider in Settings. Adding a preset makes the existing BYOK path discoverable without introducing a new adapter or dependency.
What changed
https://openrouter.ai/api/v1and current model suggestions.QUICKSTART.md.Validation
pnpm installpnpm --filter @open-design/web test -- apps/web/tests/components/SettingsDialog.test.ts apps/web/tests/providers/openai-compatible.test.tspnpm --filter @open-design/web typecheckpnpm guardpnpm --filter @open-design/desktop buildpnpm typecheck