|
| 1 | +--- |
| 2 | +sidebar_position: 15 |
| 3 | +title: "MiniMax OAuth" |
| 4 | +description: "Log into MiniMax via browser OAuth and use MiniMax-M2.7 models in Hermes Agent — no API key required" |
| 5 | +--- |
| 6 | + |
| 7 | +# MiniMax OAuth |
| 8 | + |
| 9 | +Hermes Agent supports **MiniMax** through a browser-based OAuth login flow, using the same credentials as the [MiniMax portal](https://www.minimax.io). No API key or credit card is required — log in once and Hermes automatically refreshes your session. |
| 10 | + |
| 11 | +The transport reuses the `anthropic_messages` adapter (MiniMax exposes an Anthropic Messages-compatible endpoint at `/anthropic`), so all existing tool-calling, streaming, and context features work without any adapter changes. |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +| Item | Value | |
| 16 | +|------|-------| |
| 17 | +| Provider ID | `minimax-oauth` | |
| 18 | +| Display name | MiniMax (OAuth) | |
| 19 | +| Auth type | Browser OAuth (PKCE device-code flow) | |
| 20 | +| Transport | Anthropic Messages-compatible (`anthropic_messages`) | |
| 21 | +| Models | `MiniMax-M2.7`, `MiniMax-M2.7-highspeed` | |
| 22 | +| Global endpoint | `https://api.minimax.io/anthropic` | |
| 23 | +| China endpoint | `https://api.minimaxi.com/anthropic` | |
| 24 | +| Requires env var | No (`MINIMAX_API_KEY` is **not** used for this provider) | |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +- Python 3.9+ |
| 29 | +- Hermes Agent installed |
| 30 | +- A MiniMax account at [minimax.io](https://www.minimax.io) (global) or [minimaxi.com](https://www.minimaxi.com) (China) |
| 31 | +- A browser available on the local machine (or use `--no-browser` for remote sessions) |
| 32 | + |
| 33 | +## Quick Start |
| 34 | + |
| 35 | +```bash |
| 36 | +# Launch the provider and model picker |
| 37 | +hermes model |
| 38 | +# → Select "MiniMax (OAuth)" from the provider list |
| 39 | +# → Hermes opens your browser to the MiniMax authorization page |
| 40 | +# → Approve access in the browser |
| 41 | +# → Select a model (MiniMax-M2.7 or MiniMax-M2.7-highspeed) |
| 42 | +# → Start chatting |
| 43 | + |
| 44 | +hermes |
| 45 | +``` |
| 46 | + |
| 47 | +After the first login, credentials are stored under `~/.hermes/auth.json` and are refreshed automatically before each session. |
| 48 | + |
| 49 | +## Logging In Manually |
| 50 | + |
| 51 | +You can trigger a login without going through the model picker: |
| 52 | + |
| 53 | +```bash |
| 54 | +hermes auth add minimax-oauth |
| 55 | +``` |
| 56 | + |
| 57 | +### China region |
| 58 | + |
| 59 | +If your account is on the China platform (`minimaxi.com`), pass `--region cn`: |
| 60 | + |
| 61 | +```bash |
| 62 | +hermes auth add minimax-oauth --region cn |
| 63 | +``` |
| 64 | + |
| 65 | +### Remote / headless sessions |
| 66 | + |
| 67 | +On servers or containers where no browser is available: |
| 68 | + |
| 69 | +```bash |
| 70 | +hermes auth add minimax-oauth --no-browser |
| 71 | +``` |
| 72 | + |
| 73 | +Hermes will print the verification URL and user code — open the URL on any device and enter the code when prompted. |
| 74 | + |
| 75 | +## The OAuth Flow |
| 76 | + |
| 77 | +Hermes implements a PKCE device-code flow against the MiniMax OAuth endpoints: |
| 78 | + |
| 79 | +1. Hermes generates a PKCE verifier / challenge pair and a random state value. |
| 80 | +2. It POSTs to `{base_url}/oauth/code` with the challenge and receives a `user_code` and `verification_uri`. |
| 81 | +3. Your browser opens `verification_uri`. If prompted, enter the `user_code`. |
| 82 | +4. Hermes polls `{base_url}/oauth/token` until the token arrives (or the deadline passes). |
| 83 | +5. Tokens (`access_token`, `refresh_token`, expiry) are saved to `~/.hermes/auth.json` under the `minimax-oauth` key. |
| 84 | + |
| 85 | +Token refresh (standard OAuth `refresh_token` grant) runs automatically at each session start when the access token is within 60 seconds of expiry. |
| 86 | + |
| 87 | +## Checking Login Status |
| 88 | + |
| 89 | +```bash |
| 90 | +hermes doctor |
| 91 | +``` |
| 92 | + |
| 93 | +The `◆ Auth Providers` section will show: |
| 94 | + |
| 95 | +``` |
| 96 | +✓ MiniMax OAuth (logged in, region=global) |
| 97 | +``` |
| 98 | + |
| 99 | +or, if not logged in: |
| 100 | + |
| 101 | +``` |
| 102 | +⚠ MiniMax OAuth (not logged in) |
| 103 | +``` |
| 104 | + |
| 105 | +## Switching Models |
| 106 | + |
| 107 | +```bash |
| 108 | +hermes model |
| 109 | +# → Select "MiniMax (OAuth)" |
| 110 | +# → Pick from the model list |
| 111 | +``` |
| 112 | + |
| 113 | +Or set the model directly: |
| 114 | + |
| 115 | +```bash |
| 116 | +hermes config set model MiniMax-M2.7 |
| 117 | +hermes config set provider minimax-oauth |
| 118 | +``` |
| 119 | + |
| 120 | +## Configuration Reference |
| 121 | + |
| 122 | +After login, `~/.hermes/config.yaml` will contain entries similar to: |
| 123 | + |
| 124 | +```yaml |
| 125 | +model: |
| 126 | + default: MiniMax-M2.7 |
| 127 | + provider: minimax-oauth |
| 128 | + base_url: https://api.minimax.io/anthropic |
| 129 | +``` |
| 130 | +
|
| 131 | +### `--region` flag |
| 132 | + |
| 133 | +| Value | Portal | Inference endpoint | |
| 134 | +|-------|--------|-------------------| |
| 135 | +| `global` (default) | `https://api.minimax.io` | `https://api.minimax.io/anthropic` | |
| 136 | +| `cn` | `https://api.minimaxi.com` | `https://api.minimaxi.com/anthropic` | |
| 137 | + |
| 138 | +### Provider aliases |
| 139 | + |
| 140 | +All of the following resolve to `minimax-oauth`: |
| 141 | + |
| 142 | +```bash |
| 143 | +hermes --provider minimax-oauth # canonical |
| 144 | +hermes --provider minimax-portal # alias |
| 145 | +hermes --provider minimax-global # alias |
| 146 | +hermes --provider minimax_oauth # alias (underscore form) |
| 147 | +``` |
| 148 | + |
| 149 | +## Environment Variables |
| 150 | + |
| 151 | +The `minimax-oauth` provider does **not** use `MINIMAX_API_KEY` or `MINIMAX_BASE_URL`. Those variables are for the API-key-based `minimax` and `minimax-cn` providers only. |
| 152 | + |
| 153 | +| Variable | Effect | |
| 154 | +|----------|--------| |
| 155 | +| `MINIMAX_API_KEY` | Used by `minimax` provider only — ignored for `minimax-oauth` | |
| 156 | +| `MINIMAX_CN_API_KEY` | Used by `minimax-cn` provider only — ignored for `minimax-oauth` | |
| 157 | + |
| 158 | +To force the `minimax-oauth` provider at runtime: |
| 159 | + |
| 160 | +```bash |
| 161 | +HERMES_INFERENCE_PROVIDER=minimax-oauth hermes |
| 162 | +``` |
| 163 | + |
| 164 | +## Models |
| 165 | + |
| 166 | +| Model | Best for | |
| 167 | +|-------|----------| |
| 168 | +| `MiniMax-M2.7` | Long-context reasoning, complex tool-calling | |
| 169 | +| `MiniMax-M2.7-highspeed` | Lower latency, lighter tasks, auxiliary calls | |
| 170 | + |
| 171 | +Both models support up to 200,000 tokens of context. |
| 172 | + |
| 173 | +`MiniMax-M2.7-highspeed` is also used automatically as the auxiliary model for vision and delegation tasks when `minimax-oauth` is the primary provider. |
| 174 | + |
| 175 | +## Troubleshooting |
| 176 | + |
| 177 | +### Token expired — not re-logging in automatically |
| 178 | + |
| 179 | +Hermes refreshes the token on every session start if it is within 60 seconds of expiry. If the access token is already expired (for example, after a long offline period), the refresh happens automatically on the next request. If refresh fails with `refresh_token_reused` or `invalid_grant`, Hermes marks the session as requiring re-login. |
| 180 | + |
| 181 | +**Fix:** run `hermes auth add minimax-oauth` again to start a fresh login. |
| 182 | + |
| 183 | +### Authorization timed out |
| 184 | + |
| 185 | +The device-code flow has a finite expiry window. If you don't approve the login in time, Hermes raises a timeout error. |
| 186 | + |
| 187 | +**Fix:** re-run `hermes auth add minimax-oauth` (or `hermes model`). The flow starts fresh. |
| 188 | + |
| 189 | +### State mismatch (possible CSRF) |
| 190 | + |
| 191 | +Hermes detected that the `state` value returned by the authorization server does not match what it sent. |
| 192 | + |
| 193 | +**Fix:** re-run the login. If it persists, check for a proxy or redirect that is modifying the OAuth response. |
| 194 | + |
| 195 | +### Logging in from a remote server |
| 196 | + |
| 197 | +If `hermes` cannot open a browser window, use `--no-browser`: |
| 198 | + |
| 199 | +```bash |
| 200 | +hermes auth add minimax-oauth --no-browser |
| 201 | +``` |
| 202 | + |
| 203 | +Hermes prints the URL and code. Open the URL on any device and complete the flow there. |
| 204 | + |
| 205 | +### "Not logged into MiniMax OAuth" error at runtime |
| 206 | + |
| 207 | +The auth store has no credentials for `minimax-oauth`. You have not logged in yet, or the credential file was deleted. |
| 208 | + |
| 209 | +**Fix:** run `hermes model` and select MiniMax (OAuth), or run `hermes auth add minimax-oauth`. |
| 210 | + |
| 211 | +## Logging Out |
| 212 | + |
| 213 | +To remove stored MiniMax OAuth credentials: |
| 214 | + |
| 215 | +```bash |
| 216 | +hermes auth remove minimax-oauth |
| 217 | +``` |
| 218 | + |
| 219 | +## See Also |
| 220 | + |
| 221 | +- [AI Providers reference](../integrations/providers.md) |
| 222 | +- [Environment Variables](../reference/environment-variables.md) |
| 223 | +- [Configuration](../user-guide/configuration.md) |
| 224 | +- [hermes doctor](../reference/cli-commands.md) |
0 commit comments