Skip to content
8 changes: 6 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func run() (exitStatus int) {
var xaiLogin bool
var devinLogin bool
var metaLogin bool
var mistralLogin bool
var discoverGateways bool
var discoverTimeout int
var discoverJSON bool
Expand Down Expand Up @@ -162,6 +163,7 @@ func run() (exitStatus int) {
flag.BoolVar(&xaiLogin, "xai-login", false, "Login to xAI using OAuth")
flag.BoolVar(&devinLogin, "devin-login", false, "Login to Devin using OAuth")
flag.BoolVar(&metaLogin, "meta-login", false, "Login to Meta using OAuth")
flag.BoolVar(&mistralLogin, "mistral-login", false, "Login to Mistral (Vibe / Le Chat Pro) using browser sign-in")
flag.BoolVar(&discoverGateways, "discover", false, "Discover local AI gateways and CPA instances on the LAN")
flag.IntVar(&discoverTimeout, "discover-timeout", 3, "Timeout in seconds for LAN discovery (default 3s)")
flag.BoolVar(&discoverJSON, "discover-json", false, "Output discovered gateways in JSON format")
Expand Down Expand Up @@ -683,7 +685,7 @@ func run() (exitStatus int) {
ProxyURL: loginProxyURL,
}

commandMode := vertexImport != "" || siwcBind != "" || antigravityLogin || codexLogin || codexDeviceLogin || claudeLogin || kimiLogin || kimiAILogin || xaiLogin || devinLogin || metaLogin
commandMode := vertexImport != "" || siwcBind != "" || antigravityLogin || codexLogin || codexDeviceLogin || claudeLogin || kimiLogin || kimiAILogin || xaiLogin || devinLogin || metaLogin || mistralLogin
cloudConfigMissing := isCloudDeploy && !configFileExists
homeMode := configLoadedFromHome || (cfg != nil && cfg.Home.Enabled)
exampleAPIKeySafeMode := shouldEnableExampleAPIKeySafeMode(cfg, commandMode, tuiMode, standalone, cloudConfigMissing, homeMode)
Expand Down Expand Up @@ -763,6 +765,8 @@ func run() (exitStatus int) {
cmd.DoDevinLogin(cfg, options)
} else if metaLogin {
cmd.DoMetaLogin(cfg, options)
} else if mistralLogin {
cmd.DoMistralLogin(cfg, options)
} else {
// In cloud deploy mode without config file, just wait for shutdown signals
if isCloudDeploy && !configFileExists {
Expand Down Expand Up @@ -1010,7 +1014,7 @@ func argvEnablesBoolFlag(args []string, name string) bool {
func argvFlagConsumesValue(name string) bool {
switch name {
case "codex-login", "codex-device-login", "claude-login", "no-browser",
"antigravity-login", "kimi-login", "kimi-ai-login", "xai-login", "devin-login", "meta-login",
"antigravity-login", "kimi-login", "kimi-ai-login", "xai-login", "devin-login", "meta-login", "mistral-login",
"discover", "discover-json", "home-disable-cluster-discovery",
"tui", "standalone", "local-model":
return false
Expand Down
12 changes: 11 additions & 1 deletion docs/management-api-v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ retain the corresponding business operation's fields.

The login URL is shared by all providers. Set the required `provider` query
parameter to `claude`, `codex`, `antigravity`, `kimi`, `kimi-ai`, `xai`, `devin`,
`meta`, or a registered plugin provider ID. For example:
`meta`, `mistral`, or a registered plugin provider ID. For example:

```http
GET /v8/management/oauth/auth-url?provider=codex
Expand All @@ -189,6 +189,16 @@ an explicit provider must match that state. Poll until the status is `ok` or
`error`; `wait` means the login is still pending. Callback acceptance alone does
not mean credential exchange and persistence have completed.

`mistral` signs in a Mistral Vibe or Le Chat Pro account through the browser.
The response has `flow: "device"`, the sign-in `url` to open, the `state`, and
`expires_in` (seconds); there is no `user_code`. Poll `/oauth/status` until it is
`ok` or `error`, or cancel with `DELETE /oauth/session`. A successful sign-in
saves `mistral-<hash>.json` (mode `0600`) holding an API key that does not
expire and has no refresh token. Requests use that key against
`https://api.mistral.ai/v1`. If Mistral rejects the key, re-run the sign-in
with `name` set to the credential file to replace it in place. The CLI flag is
`--mistral-login`.

Import uses `POST /v8/management/oauth/import?provider=vertex`. The `provider`
query parameter is required; Vertex is currently the supported import provider.

Expand Down
Loading
Loading