Skip to content

Add OpenRouter as a new AI provider#12626

Merged
estib-vega merged 11 commits intogitbutlerapp:masterfrom
RemiKalbe:master
Apr 14, 2026
Merged

Add OpenRouter as a new AI provider#12626
estib-vega merged 11 commits intogitbutlerapp:masterfrom
RemiKalbe:master

Conversation

@RemiKalbe
Copy link
Copy Markdown
Contributor

@RemiKalbe RemiKalbe commented Feb 28, 2026

🧢 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/model format (e.g. openai/gpt-4.1-mini).

Frontend: new OpenRouter variant in ModelKind, config keys, secret handle, service methods, settings panel with API key and model inputs, and two new tests.

Backend: new OpenRouterProvider following the LM Studio pattern which implements OpenAIClientProvider + LLMClient, reads API key from secret storage with OPENROUTER_API_KEY env var fallback.

CSP: added https://openrouter.ai to connect-src.

🎫 Affected issues

Fixes: #12070

Preview

CleanShot 2026-02-27 at 16 26 46@2x

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 28, 2026

@RemiKalbe is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread crates/but-llm/src/openrouter.rs Outdated
@Byron
Copy link
Copy Markdown
Collaborator

Byron commented Feb 28, 2026

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: pnpm begood should fix the frontend lint errors, cargo fmt will do the same to the backend, cargo clippy --workspace --all-targets should do the rest.

@Byron
Copy link
Copy Markdown
Collaborator

Byron commented Feb 28, 2026

@codex review

@Byron Byron marked this pull request as draft February 28, 2026 04:12
@Byron Byron requested a review from estib-vega February 28, 2026 04:12
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment thread apps/desktop/src/lib/ai/service.ts Outdated
@RemiKalbe RemiKalbe marked this pull request as ready for review March 24, 2026 01:00
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce2d869866

ℹ️ 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".

Comment thread apps/desktop/src/lib/ai/service.ts
@RemiKalbe
Copy link
Copy Markdown
Contributor Author

The fmt should pass now! Could you re run ci?

@Byron
Copy link
Copy Markdown
Collaborator

Byron commented Apr 8, 2026

Sorry for the wait!

CI is running and I hope it will pass. Maybe from there we can get it merged, OpenRouter support seems very useful.

@RemiKalbe
Copy link
Copy Markdown
Contributor Author

Okay it should be good for real 😭

@RemiKalbe
Copy link
Copy Markdown
Contributor Author

Looks like a lot changed upstream since I opened this PR, specifically the new but CLI config system for AI providers (but config ai openai/anthropic/...). I've rebased and pushed fixes that wire OpenRouter into all of that, hopefully CI passes now

@Byron
Copy link
Copy Markdown
Collaborator

Byron commented Apr 14, 2026

Thanks again for updating it. I will do my best to get it reviewed.

- Prefer setting the type at the key extraction level than casting
- Deduplicate the git config keys for Open Router (prefer the exported
  ones from lib)
Copy link
Copy Markdown
Contributor

@estib-vega estib-vega left a comment

Choose a reason for hiding this comment

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

Looks good!

Thanks for adding this :)

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
gitbutler-web Ignored Ignored Preview Apr 14, 2026 8:34am

Request Review

@estib-vega estib-vega enabled auto-merge April 14, 2026 08:38
@estib-vega estib-vega merged commit 0f8df89 into gitbutlerapp:master Apr 14, 2026
35 of 36 checks passed
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.

Support OpenRouter as AI Provider

3 participants