Repository navigation
Add native OpenRouter OAuth support - #6927
Merged
Merged
Conversation
Author
|
I manually tested the complete OpenRouter OAuth flow locally: started pi, signed in through the browser, completed the loopback callback, and sent a real request successfully. The OpenRouter model responded as expected |
rsaryev
force-pushed
the
feat/openrouter-oauth
branch
from
July 21, 2026 20:28
5a6f959 to
64946d5
Compare
rsaryev
force-pushed
the
feat/openrouter-oauth
branch
from
July 21, 2026 20:30
64946d5 to
01c7d57
Compare
Collaborator
|
@rsaryev lgtm please resolve the merge co flicts |
Collaborator
|
cheers! |
1 task
hamishfromatech
added a commit
to hamishfromatech/a-coder-cli
that referenced
this pull request
Sep 9, 2026
/login openrouter runs a PKCE authorization flow against a one-shot
loopback callback server (ephemeral port, PI_OAUTH_CALLBACK_HOST
override) and exchanges the authorization code for a permanent,
user-controlled OpenRouter API key — no refresh cycle, expires
MAX_SAFE_INTEGER. Both OpenRouter providers expose OAuth alongside
OPENROUTER_API_KEY via lazyOAuth; the OAuth registry registers
openRouterOAuthProvider as a built-in.
OAuthAuth gained an optional loginLabel ("Sign in with OpenRouter") for
login menus, passed through lazyOAuth. Ported the upstream test suite
(PKCE verification, single-use callback, exchange failure surfacing,
cancel semantics, callback-host override) adapted to the fork's
Models.getAuth(model) and module paths. The manual-code race surface in
loginOpenRouter stays dormant until the headless fallback port wires it.
jinhuang712
pushed a commit
to jinhuang712/pi
that referenced
this pull request
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native OpenRouter OAuth support through
Provider.auth.oauth.The flow uses browser authorization, PKCE S256, and a one-shot ephemeral localhost callback with timeout, cancellation, and response validation. The returned user-controlled API key works with both text and image providers, while
OPENROUTER_API_KEYremains supported.Testing
npm run checknpm run buildCloses #6814