Add OpenRouter as a new AI provider#12626
Add OpenRouter as a new AI provider#12626RemiKalbe wants to merge 5 commits intogitbutlerapp:masterfrom
Conversation
|
@RemiKalbe is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eaa15c57d3
ℹ️ 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".
Adds checks to verify that retrieved API keys are not empty or solely whitespace. This prevents attempts to use invalid credentials, improving reliability.
|
Thanks a lot for contributing! At first glance it does look like a run-of-the-mill integration that might do the trick, but I didn't test it locally, nor am I aware of any gotchas to look out for. Hence, let's pass this on to @estib-vega for proper validation. PS: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e05843155
ℹ️ 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".
|
|
||
| return new OpenAIClient( | ||
| openRouterKey, | ||
| openRouterModelName as OpenRouterModelName, |
There was a problem hiding this comment.
Validate OpenRouter model name before constructing client
buildClient() force-casts openRouterModelName to OpenRouterModelName without any runtime check, while the settings UI accepts arbitrary free-form text for that field. If a user saves an invalid value (for example missing the provider/model format), configuration still appears valid and failures only surface as downstream OpenRouter API errors during generation. Add a format check (or fallback to the default model) before creating OpenAIClient so misconfiguration is caught deterministically.
Useful? React with 👍 / 👎.
🧢 Changes
Add OpenRouter as a new AI provider. OpenRouter exposes an OpenAI-compatible API, so the frontend reuses OpenAIClient with the OpenRouter base URL. The model name is a free-form text input since OpenRouter supports hundreds of models in
provider/modelformat (e.g.openai/gpt-4.1-mini).Frontend: new
OpenRoutervariant inModelKind, config keys, secret handle, service methods, settings panel with API key and model inputs, and two new tests.Backend: new
OpenRouterProviderfollowing the LM Studio pattern which implementsOpenAIClientProvider + LLMClient, reads API key from secret storage withOPENROUTER_API_KEYenv var fallback.CSP: added
https://openrouter.aitoconnect-src.🎫 Affected issues
Fixes: #12070
Preview