mu-agent 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/README.md +7 -3
- package/dist/bundle/chunks/anthropic-messages-VMESUHQ7.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-K232MQFF.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
- package/dist/bundle/chunks/chunk-2X3AO33C.js +2 -0
- package/dist/bundle/chunks/{chunk-FUXEF6JQ.js → chunk-4O2SCVYF.js} +1 -1
- package/dist/bundle/chunks/chunk-E3TC4YNV.js +2 -0
- package/dist/bundle/chunks/chunk-FU4XQUSL.js +11 -0
- package/dist/bundle/chunks/{chunk-S7SZN6Z3.js → chunk-GNYZK6XN.js} +1 -1
- package/dist/bundle/chunks/chunk-MVPXOVOJ.js +2 -0
- package/dist/bundle/chunks/{chunk-AIR4ZKSM.js → chunk-TUBB3BLE.js} +71 -64
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/{chunk-WIUZI2CJ.js → chunk-V7IXECST.js} +2 -2
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NR2TDCXU.js +2 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-C44KRRZ4.js +2 -0
- package/dist/bundle/chunks/google-vertex-25DUXPTJ.js +2 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-6IHQOR4R.js +5 -0
- package/dist/bundle/chunks/{openai-codex-responses-QDSOTBBO.js → openai-codex-responses-3UAYOSSR.js} +2 -2
- package/dist/bundle/chunks/{openai-completions-KQPOPEVM.js → openai-completions-FIEQGWAH.js} +3 -3
- package/dist/bundle/chunks/openai-responses-OZJXLHFC.js +2 -0
- package/dist/bundle/chunks/{openrouter-images-N4XVVFSD.js → openrouter-images-JVEJN44Q.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-GFKBWJHZ.js → pi-messages-TM5SOOIW.js} +2 -2
- package/dist/bundle/chunks/typesafe-system-one-VKYX4OGY.js +2 -0
- package/dist/bundle/chunks/{virtual-modules-I4HUN7PP.js → virtual-modules-IOLJJ5KK.js} +1 -1
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +4 -2
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/export-html/template.css +10 -0
- package/dist/core/export-html/template.js +56 -18
- package/dist/modes/interactive/theme/theme-controller.d.ts +6 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +41 -3
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-json.js +3 -1
- package/dist/modes/interactive/theme/theme-json.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +7 -2
- package/dist/modes/interactive/theme/theme.d.ts +40 -7
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +122 -214
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +268 -0
- package/docs/compaction.md +45 -26
- package/docs/configuration.md +45 -0
- package/docs/containerization.md +109 -82
- package/docs/custom-provider.md +109 -722
- package/docs/docs.json +139 -99
- package/docs/environment-variables.md +3 -5
- package/docs/extensions.md +137 -2953
- package/docs/how-pi-works.md +49 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/index.md +24 -69
- package/docs/json.md +193 -65
- package/docs/keybindings.md +57 -102
- package/docs/llama-cpp.md +3 -3
- package/docs/message-types.md +261 -0
- package/docs/models.md +64 -546
- package/docs/packages.md +67 -166
- package/docs/prompt-templates.md +31 -68
- package/docs/providers.md +102 -232
- package/docs/quickstart.md +61 -106
- package/docs/rpc-commands.md +854 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +129 -1556
- package/docs/sdk.md +76 -1160
- package/docs/security.md +70 -32
- package/docs/session-format.md +25 -216
- package/docs/sessions.md +35 -141
- package/docs/settings.md +109 -387
- package/docs/shell-aliases.md +85 -5
- package/docs/skills.md +51 -190
- package/docs/slash-commands.md +60 -0
- package/docs/terminal-setup.md +105 -78
- package/docs/termux.md +74 -83
- package/docs/themes.md +71 -279
- package/docs/tmux.md +31 -39
- package/docs/tui.md +74 -910
- package/docs/usage.md +54 -272
- package/docs/windows.md +43 -17
- package/examples/README.md +13 -2
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/src/session.ts +3 -2
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +25 -5
- package/examples/sdk/README.md +1 -1
- package/judge/dist/auth.js +166 -28
- package/judge/dist/chrome.js +12 -1
- package/judge/dist/kyrn-judge.js +2144 -968
- package/judge/dist/setup.js +2051 -0
- package/judge/manifest.json +117 -13
- package/judge/skills/mu-browser/SKILL.md +1 -0
- package/kyrn/bin/kyrn-doctor +107 -18
- package/kyrn/bin/mu.mjs +296 -19
- package/package.json +4 -4
- package/dist/bundle/chunks/anthropic-messages-MYU5ZMRF.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-HUSQ3GP2.js +0 -2
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +0 -2
- package/dist/bundle/chunks/chunk-RCZIEVGO.js +0 -11
- package/dist/bundle/chunks/chunk-WSSPR443.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-IMS5EK2Y.js +0 -2
- package/dist/bundle/chunks/google-vertex-O4YJEQUW.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-NOSQHBEY.js +0 -5
- package/dist/bundle/chunks/openai-responses-HWEUZ6WZ.js +0 -2
- package/docs/development.md +0 -90
package/docs/providers.md
CHANGED
|
@@ -1,317 +1,187 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Provider Authentication
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Most hosted providers support one or both of these authentication methods:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Sign in through a browser or device flow backed by OAuth.
|
|
6
|
+
- Provide an API key.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- [API Keys](#api-keys)
|
|
9
|
-
- [Auth File](#auth-file)
|
|
10
|
-
- [Cloud Providers](#cloud-providers)
|
|
11
|
-
- [llama.cpp](#llamacpp)
|
|
12
|
-
- [Custom Providers](#custom-providers)
|
|
13
|
-
- [Resolution Order](#resolution-order)
|
|
8
|
+
Use `/login [provider]` to see the methods supported by a provider. Amazon Bedrock and Google Vertex AI can also use ambient cloud credentials.
|
|
14
9
|
|
|
15
|
-
##
|
|
10
|
+
## Authenticate interactively
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
Run `/login` and select a provider. Pi guides you through its OAuth or API-key flow and saves the resulting credential in [`auth.json`](configuration.md#agent-directory).
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
- Claude Pro/Max
|
|
21
|
-
- GitHub Copilot
|
|
22
|
-
- xAI (Grok/X subscription)
|
|
23
|
-
- OpenRouter (OAuth-minted API key billed from OpenRouter credits)
|
|
24
|
-
- Radius
|
|
14
|
+
On a remote or headless machine, an OAuth callback may not reach the local process. When prompted, paste the final redirect URL or authorization code back into Pi.
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
Run `/logout` and select a provider to remove its stored credential. This does not unset environment variables, remove authentication from `models.json`, or revoke the credential at the provider.
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
`auth.json` can contain API keys and OAuth tokens. Keep it private and do not commit it.
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
- Officially endorsed by OpenAI: [Codex for OSS](https://developers.openai.com/community/codex-for-oss)
|
|
20
|
+
Radius authentication uses its gateway catalog and caches refreshed model metadata for later offline startup. A custom Radius gateway configured in `models.json` uses its own catalog rather than inheriting the public `radius.pi.dev` catalog.
|
|
32
21
|
|
|
33
|
-
|
|
22
|
+
## Use an API key from the environment
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
### GitHub Copilot
|
|
38
|
-
|
|
39
|
-
- Press Enter for github.com, or enter your GitHub Enterprise Server domain
|
|
40
|
-
- If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
|
|
41
|
-
|
|
42
|
-
### xAI (Grok/X subscription)
|
|
43
|
-
|
|
44
|
-
- Run `/login xai`, then select **Use a subscription**
|
|
45
|
-
- `XAI_API_KEY` remains available through **Use an API key**
|
|
46
|
-
|
|
47
|
-
### OpenRouter
|
|
48
|
-
|
|
49
|
-
- Run `/login openrouter`, then select **Sign in with OpenRouter** to open the OpenRouter PKCE authorization flow
|
|
50
|
-
- The authorization creates a user-controlled OpenRouter API key billed from your OpenRouter credits
|
|
51
|
-
- On remote/headless machines (e.g. over SSH) the browser cannot reach the loopback callback; paste the final redirect URL (or the authorization code) into the login prompt instead
|
|
52
|
-
- `OPENROUTER_API_KEY` remains available through **Use an API key**
|
|
53
|
-
|
|
54
|
-
### Radius
|
|
55
|
-
|
|
56
|
-
Radius is a `pi-messages` gateway. Pi ships the public Radius model catalog for immediate and offline model lookup, then overlays it with the effective gateway catalog after authentication. `/login radius` stores OAuth tokens in `auth.json`; refreshed catalogs are cached in `models-store.json`. Custom Radius gateways can be declared in `models.json` with `"oauth": "radius"` and a gateway `baseUrl`; they do not inherit the public `radius.pi.dev` catalog.
|
|
57
|
-
|
|
58
|
-
## API Keys
|
|
59
|
-
|
|
60
|
-
### Environment Variables or Auth File
|
|
61
|
-
|
|
62
|
-
Use `/login` in interactive mode and select a provider to store an API key in `auth.json`, or set credentials via environment variable:
|
|
24
|
+
Environment variables are useful in CI and anywhere Pi should not store the key. Set the variable before starting Pi:
|
|
63
25
|
|
|
64
26
|
```bash
|
|
65
27
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
66
28
|
pi
|
|
67
29
|
```
|
|
68
30
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
| ZAI Coding Plan (
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
| MiniMax
|
|
98
|
-
|
|
|
99
|
-
| Qwen Token Plan
|
|
100
|
-
| Qwen Token Plan (
|
|
101
|
-
|
|
|
102
|
-
| Xiaomi MiMo
|
|
103
|
-
| Xiaomi MiMo Token Plan (
|
|
104
|
-
| Xiaomi MiMo Token Plan (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Store credentials in `~/.pi/agent/auth.json`:
|
|
31
|
+
This table covers providers with a single primary API-key variable. Providers that need additional configuration or support ambient credentials are covered under [Cloud providers](#cloud-providers).
|
|
32
|
+
|
|
33
|
+
| Provider | Environment variable |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Anthropic | `ANTHROPIC_API_KEY` |
|
|
36
|
+
| Ant Ling | `ANT_LING_API_KEY` |
|
|
37
|
+
| OpenAI | `OPENAI_API_KEY` |
|
|
38
|
+
| DeepSeek | `DEEPSEEK_API_KEY` |
|
|
39
|
+
| NVIDIA NIM | `NVIDIA_API_KEY` |
|
|
40
|
+
| Google Gemini | `GEMINI_API_KEY` |
|
|
41
|
+
| GitHub Copilot | `COPILOT_GITHUB_TOKEN` |
|
|
42
|
+
| Mistral | `MISTRAL_API_KEY` |
|
|
43
|
+
| Groq | `GROQ_API_KEY` |
|
|
44
|
+
| Cerebras | `CEREBRAS_API_KEY` |
|
|
45
|
+
| xAI | `XAI_API_KEY` |
|
|
46
|
+
| OpenRouter | `OPENROUTER_API_KEY` |
|
|
47
|
+
| Vercel AI Gateway | `AI_GATEWAY_API_KEY` |
|
|
48
|
+
| ZAI Coding Plan (Global) | `ZAI_API_KEY` |
|
|
49
|
+
| ZAI Coding Plan (China) | `ZAI_CODING_CN_API_KEY` |
|
|
50
|
+
| OpenCode Zen and Go | `OPENCODE_API_KEY` |
|
|
51
|
+
| Radius | `RADIUS_API_KEY` |
|
|
52
|
+
| Hugging Face | `HF_TOKEN` |
|
|
53
|
+
| Fireworks | `FIREWORKS_API_KEY` |
|
|
54
|
+
| Together AI | `TOGETHER_API_KEY` |
|
|
55
|
+
| Baseten | `BASETEN_API_KEY` |
|
|
56
|
+
| Kimi For Coding | `KIMI_API_KEY` |
|
|
57
|
+
| Meta | `META_API_KEY` |
|
|
58
|
+
| MiniMax | `MINIMAX_API_KEY` |
|
|
59
|
+
| MiniMax (China) | `MINIMAX_CN_API_KEY` |
|
|
60
|
+
| Moonshot AI (Global and China) | `MOONSHOT_API_KEY` |
|
|
61
|
+
| Qwen Token Plan and Individual | `QWEN_TOKEN_PLAN_API_KEY` |
|
|
62
|
+
| Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
|
|
63
|
+
| Xiaomi MiMo | `XIAOMI_API_KEY` |
|
|
64
|
+
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
|
|
65
|
+
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` |
|
|
66
|
+
| Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` |
|
|
67
|
+
|
|
68
|
+
Anthropic also recognizes `ANTHROPIC_OAUTH_TOKEN` as an API credential and `ANTHROPIC_AUTH_TOKEN` as bearer authentication.
|
|
69
|
+
|
|
70
|
+
## Load an API key from a command
|
|
71
|
+
|
|
72
|
+
To use a secret manager without writing the resolved key to disk, set a provider's `key` in `auth.json` to a command prefixed with `!`:
|
|
112
73
|
|
|
113
74
|
```json
|
|
114
75
|
{
|
|
115
|
-
"anthropic": {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"nvidia": { "type": "api_key", "key": "nvapi-..." },
|
|
120
|
-
"google": { "type": "api_key", "key": "..." },
|
|
121
|
-
"opencode": { "type": "api_key", "key": "..." },
|
|
122
|
-
"opencode-go": { "type": "api_key", "key": "..." },
|
|
123
|
-
"together": { "type": "api_key", "key": "..." },
|
|
124
|
-
"qwen-token-plan": { "type": "api_key", "key": "sk-sp-..." },
|
|
125
|
-
"qwen-token-plan-individual": { "type": "api_key", "key": "sk-sp-..." },
|
|
126
|
-
"qwen-token-plan-cn": { "type": "api_key", "key": "sk-sp-..." },
|
|
127
|
-
"xiaomi": { "type": "api_key", "key": "..." },
|
|
128
|
-
"xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
|
|
129
|
-
"xiaomi-token-plan-ams": { "type": "api_key", "key": "..." },
|
|
130
|
-
"xiaomi-token-plan-sgp": { "type": "api_key", "key": "..." }
|
|
76
|
+
"anthropic": {
|
|
77
|
+
"type": "api_key",
|
|
78
|
+
"key": "!security find-generic-password -ws 'anthropic'"
|
|
79
|
+
}
|
|
131
80
|
}
|
|
132
81
|
```
|
|
133
82
|
|
|
134
|
-
|
|
135
|
-
`qwen-token-plan`, but limits the picker to the models documented for Individual subscriptions. The existing
|
|
136
|
-
provider keeps its broader catalog for backward compatibility. When using `auth.json`, store the
|
|
137
|
-
credential under the provider you select; an environment variable is shared by both international providers.
|
|
83
|
+
Pi runs the command when the key is first needed and caches its standard output for the process lifetime. Empty output, a timeout, or a nonzero exit leaves the key unresolved until Pi restarts.
|
|
138
84
|
|
|
139
|
-
|
|
85
|
+
## Cloud Providers
|
|
86
|
+
|
|
87
|
+
The providers below need additional settings or can use credentials supplied by their cloud platform.
|
|
140
88
|
|
|
141
|
-
API
|
|
89
|
+
A stored API-key credential can include an `env` object. Its values take priority over the process environment for that provider:
|
|
142
90
|
|
|
143
91
|
```json
|
|
144
92
|
{
|
|
145
|
-
"cloudflare-ai
|
|
93
|
+
"cloudflare-workers-ai": {
|
|
146
94
|
"type": "api_key",
|
|
147
|
-
"key": "
|
|
95
|
+
"key": "...",
|
|
148
96
|
"env": {
|
|
149
|
-
"
|
|
150
|
-
"CLOUDFLARE_ACCOUNT_ID": "account-id",
|
|
151
|
-
"CLOUDFLARE_GATEWAY_ID": "gateway-id"
|
|
97
|
+
"CLOUDFLARE_ACCOUNT_ID": "account-id"
|
|
152
98
|
}
|
|
153
99
|
}
|
|
154
100
|
}
|
|
155
101
|
```
|
|
156
102
|
|
|
157
|
-
Use this when pi should use different provider settings than the project shell environment.
|
|
158
|
-
|
|
159
|
-
### Key Resolution
|
|
160
|
-
|
|
161
|
-
The `key` field supports command execution, environment interpolation, and literals:
|
|
162
|
-
|
|
163
|
-
- **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout (cached for process lifetime)
|
|
164
|
-
```json
|
|
165
|
-
{ "type": "api_key", "key": "!security find-generic-password -ws 'anthropic'" }
|
|
166
|
-
{ "type": "api_key", "key": "!op read 'op://vault/item/credential'" }
|
|
167
|
-
```
|
|
168
|
-
- **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
|
|
169
|
-
```json
|
|
170
|
-
{ "type": "api_key", "key": "$MY_ANTHROPIC_KEY" }
|
|
171
|
-
{ "type": "api_key", "key": "${KEY_PREFIX}_${KEY_SUFFIX}" }
|
|
172
|
-
```
|
|
173
|
-
`$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
|
|
174
|
-
- **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
|
|
175
|
-
```json
|
|
176
|
-
{ "type": "api_key", "key": "$$literal-dollar-prefix" }
|
|
177
|
-
{ "type": "api_key", "key": "$!literal-bang-prefix" }
|
|
178
|
-
```
|
|
179
|
-
- **Literal value:** Used directly. Plain uppercase strings such as `MY_API_KEY` are literals; use `$MY_API_KEY` for environment variables.
|
|
180
|
-
```json
|
|
181
|
-
{ "type": "api_key", "key": "sk-ant-..." }
|
|
182
|
-
{ "type": "api_key", "key": "public" }
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
OAuth credentials are also stored here after `/login` and managed automatically.
|
|
186
|
-
|
|
187
|
-
## Cloud Providers
|
|
188
|
-
|
|
189
103
|
### Azure OpenAI
|
|
190
104
|
|
|
105
|
+
Set an API key plus either a base URL or resource name:
|
|
106
|
+
|
|
191
107
|
```bash
|
|
192
108
|
export AZURE_OPENAI_API_KEY=...
|
|
193
109
|
export AZURE_OPENAI_BASE_URL=https://your-resource.ai.azure.com
|
|
194
|
-
#
|
|
195
|
-
# also supported: https://your-resource.openai.azure.com
|
|
196
|
-
# root endpoints are auto-normalized to /openai/v1
|
|
197
|
-
# or use resource name instead of base URL
|
|
110
|
+
# Or:
|
|
198
111
|
export AZURE_OPENAI_RESOURCE_NAME=your-resource
|
|
199
|
-
|
|
200
|
-
# Optional
|
|
201
|
-
export AZURE_OPENAI_API_VERSION=2024-02-01
|
|
202
|
-
export AZURE_OPENAI_DEPLOYMENT_NAME_MAP=gpt-4=my-gpt4,gpt-4o=my-gpt4o
|
|
203
112
|
```
|
|
204
113
|
|
|
114
|
+
Resource root URLs under `ai.azure.com`, `cognitiveservices.azure.com`, and `openai.azure.com` are normalized to the OpenAI API path.
|
|
115
|
+
|
|
205
116
|
### Amazon Bedrock
|
|
206
117
|
|
|
207
|
-
|
|
118
|
+
Bedrock can use a bearer token or an ambient AWS credential source:
|
|
208
119
|
|
|
209
120
|
```bash
|
|
210
|
-
#
|
|
121
|
+
# Named profile
|
|
211
122
|
export AWS_PROFILE=your-profile
|
|
212
123
|
|
|
213
|
-
#
|
|
124
|
+
# IAM keys
|
|
214
125
|
export AWS_ACCESS_KEY_ID=AKIA...
|
|
215
126
|
export AWS_SECRET_ACCESS_KEY=...
|
|
127
|
+
# Required for temporary credentials
|
|
128
|
+
export AWS_SESSION_TOKEN=...
|
|
216
129
|
|
|
217
|
-
#
|
|
130
|
+
# Bedrock bearer token
|
|
218
131
|
export AWS_BEARER_TOKEN_BEDROCK=...
|
|
219
132
|
|
|
220
|
-
#
|
|
133
|
+
# Region, when not supplied by the profile or AWS SDK configuration
|
|
221
134
|
export AWS_REGION=us-west-2
|
|
135
|
+
# AWS_DEFAULT_REGION is also supported
|
|
222
136
|
```
|
|
223
137
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
Prompt caching is enabled automatically for Claude models whose ID contains a recognizable model name (base models and system-defined inference profiles). For application inference profiles (whose ARNs don't contain the model name), set `AWS_BEDROCK_FORCE_CACHE=1` to enable cache points:
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
export AWS_BEDROCK_FORCE_CACHE=1
|
|
234
|
-
pi --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
# Set the URL for the Bedrock proxy (standard AWS SDK env var)
|
|
241
|
-
export AWS_ENDPOINT_URL_BEDROCK_RUNTIME=https://my.corp.proxy/bedrock
|
|
242
|
-
|
|
243
|
-
# Set if your proxy does not require authentication
|
|
244
|
-
export AWS_BEDROCK_SKIP_AUTH=1
|
|
245
|
-
|
|
246
|
-
# Set if your proxy only supports HTTP/1.1
|
|
247
|
-
export AWS_BEDROCK_FORCE_HTTP1=1
|
|
248
|
-
```
|
|
138
|
+
Pi also supports ECS task credentials and IRSA through the standard `AWS_CONTAINER_CREDENTIALS_*` and `AWS_WEB_IDENTITY_TOKEN_FILE` variables.
|
|
249
139
|
|
|
250
140
|
### Cloudflare AI Gateway
|
|
251
141
|
|
|
252
|
-
|
|
142
|
+
The gateway requires a token, account ID, and gateway ID:
|
|
253
143
|
|
|
254
144
|
```bash
|
|
255
|
-
export CLOUDFLARE_API_KEY=...
|
|
145
|
+
export CLOUDFLARE_API_KEY=...
|
|
256
146
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
257
|
-
export CLOUDFLARE_GATEWAY_ID=...
|
|
258
|
-
pi --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
|
|
147
|
+
export CLOUDFLARE_GATEWAY_ID=...
|
|
259
148
|
```
|
|
260
149
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. Upstream authentication can be one of:
|
|
264
|
-
|
|
265
|
-
| Mode | Request auth | Upstream auth |
|
|
266
|
-
|------|--------------|---------------|
|
|
267
|
-
| Workers AI | Cloudflare token only | Cloudflare-native |
|
|
268
|
-
| Unified billing | Cloudflare token only | Cloudflare handles upstream auth and deducts credits |
|
|
269
|
-
| Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
|
|
270
|
-
| Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
|
|
150
|
+
The account and gateway IDs can come from the process environment or the credential's `env` object in `auth.json`.
|
|
271
151
|
|
|
272
|
-
|
|
152
|
+
`CLOUDFLARE_API_KEY` authenticates Pi to the gateway. Upstream access can use Cloudflare unified billing, credentials stored in the gateway, or an `Authorization` header configured for the provider in `models.json`.
|
|
273
153
|
|
|
274
154
|
### Cloudflare Workers AI
|
|
275
155
|
|
|
276
|
-
|
|
156
|
+
Workers AI requires a token and account ID:
|
|
277
157
|
|
|
278
158
|
```bash
|
|
279
|
-
export CLOUDFLARE_API_KEY=...
|
|
159
|
+
export CLOUDFLARE_API_KEY=...
|
|
280
160
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
281
|
-
pi --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
|
|
282
161
|
```
|
|
283
162
|
|
|
284
|
-
|
|
163
|
+
The account ID can also be stored in the credential's `env` object.
|
|
285
164
|
|
|
286
165
|
### Google Vertex AI
|
|
287
166
|
|
|
288
|
-
|
|
167
|
+
Use a Google Cloud API key:
|
|
289
168
|
|
|
290
169
|
```bash
|
|
291
|
-
|
|
292
|
-
export GOOGLE_CLOUD_PROJECT=your-project
|
|
293
|
-
export GOOGLE_CLOUD_LOCATION=us-central1
|
|
170
|
+
export GOOGLE_CLOUD_API_KEY=...
|
|
294
171
|
```
|
|
295
172
|
|
|
296
|
-
|
|
173
|
+
To use Application Default Credentials, configure a project and location:
|
|
297
174
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
## Custom Providers
|
|
305
|
-
|
|
306
|
-
**Via models.json:** Add Ollama, LM Studio, vLLM, or any provider that speaks a supported API (OpenAI Completions, OpenAI Responses, Anthropic Messages, Google Generative AI). See [models.md](models.md).
|
|
307
|
-
|
|
308
|
-
**Via extensions:** For providers that need custom API implementations or OAuth flows, create an extension. See [custom-provider.md](custom-provider.md) and [examples/extensions/custom-provider-gitlab-duo](../examples/extensions/custom-provider-gitlab-duo/).
|
|
175
|
+
```bash
|
|
176
|
+
export GOOGLE_CLOUD_PROJECT=your-project
|
|
177
|
+
# GCLOUD_PROJECT is also supported
|
|
178
|
+
export GOOGLE_CLOUD_LOCATION=us-central1
|
|
179
|
+
```
|
|
309
180
|
|
|
310
|
-
|
|
181
|
+
Then authenticate:
|
|
311
182
|
|
|
312
|
-
|
|
183
|
+
```bash
|
|
184
|
+
gcloud auth application-default login
|
|
185
|
+
```
|
|
313
186
|
|
|
314
|
-
|
|
315
|
-
2. `auth.json` entry (API key or OAuth token)
|
|
316
|
-
3. Environment variable
|
|
317
|
-
4. Custom provider keys from `models.json`
|
|
187
|
+
To use a service-account key file instead, set `GOOGLE_APPLICATION_CREDENTIALS` along with the project and location.
|