Repository navigation
Conversation
Adds internal/auth/mistral: PKCE S256 sign-in (start, poll, exchange) against the Mistral console API, origin and path validation of returned URLs, no-redirect HTTP client, and credential metadata/file naming that keeps the API key out of names and labels.
Auth files restored from disk carry api_key and base_url in Metadata only. Fall back to Metadata when Attributes lack them so file-based API-key providers such as Mistral work, while keeping the raw key out of Attributes and usage records. Adds mistral request-path tests, including the payload-config-last regression.
Hard-codes the Mistral Vibe model IDs instead of extending models.json, because the remote catalog refresh replaces models.json wholesale and has no Mistral section.
Registers the Mistral authenticator with the CLI auth manager and refresh registry (no scheduled refresh: the provisioned key does not expire), adds the --mistral-login flag, and builds auth records with the key in Metadata only.
Dispatch provider=mistral from /v8/management/oauth/auth-url to a sign-in flow that returns the sign-in url and state. Status and cancel reuse the generic v8 OAuth session routes. Mistral keys carry no email or account id, so targeted re-login is allowed like Kimi.
Bind the Mistral provider to the shared OpenAI-compatible executor and publish the static Mistral model list for each Mistral credential, honoring oauth-excluded-models.
Add Mistral to the TUI OAuth provider list and the v8 provider table, and document the mistral provider in the v8 management API docs.
Drive the v8 sign-in against a fake Mistral service, then serve OpenAI and Claude format requests (stream and non-stream) with the provisioned key. Add denied sign-in and upstream 401 cases, and a service-level test that a saved credential file is picked up by the watcher.
| } | ||
|
|
||
| func keyFingerprint(apiKey string) string { | ||
| sum := sha256.Sum256([]byte(strings.TrimSpace(apiKey))) |
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.
What
Adds a built-in
mistralprovider so a Mistral Vibe / Le Chat Pro plan can be used through the proxy.Sign-in uses the same browser flow as Mistral's Vibe CLI (PKCE create → server-side poll → exchange) and returns a normal Mistral API key. Plan usage is pooled across Studio, API and Vibe per Mistral's docs. The key does not expire, so there is no refresh.
--mistral-loginCLI flag (honours--no-browser,--login-proxy)provider=mistralonoauth/auth-url; status and cancel use the existing generic endpoints. No/v0changes.base_url/api_keyfrom authMetadatawhenAttributeslack them, so the raw key never lands in Attributes or usage records.mistral-large-4-0,mistral-vibe-cli-latest,mistral-vibe-cli-fast,mistral-small-latestdocs/management-api-v8.mdSecurity
sign_in_url/poll_urlmust be on the sign-in origin (poll_urlunder/api). Redirects are not followed.Tests
test/mistral_login_e2e_test.goagainst a fake Mistral: sign-in, then OpenAI/v1/chat/completionsand Claude/v1/messages(stream and non-stream) through the proxy. Asserts the upstream bearer key, path and model. Covers the denied path and an upstream 401 surfacing to the client.Results:
go vet ./...andgo buildpass.go test ./...has one failure,internal/discoveryTestAdvertiserAndBrowser_Integration(mDNS). It fails the same way onmain.main.Manual check
A local proxy and the UI from the companion PR, opened in a browser:
console.mistral.aisign-in URL is returned, the waiting state shows, cancel works.Not yet verified live: approving a sign-in and a real inference call. That needs the account owner to click approve.
Companion UI PR: vllnt/Cli-Proxy-API-Management-Center
feat/mistral-login.