@knightcodeai/cli-linux-x64 0.9.0 → 0.9.2
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/bin/CHANGELOG.md +88 -0
- package/bin/README.md +52 -19
- package/bin/docs/cli-integration.md +106 -0
- package/bin/docs/cli.md +270 -0
- package/bin/docs/compaction.md +56 -37
- package/bin/docs/configuration.md +46 -0
- package/bin/docs/containerization.md +86 -54
- package/bin/docs/custom-provider.md +132 -782
- package/bin/docs/docs.json +143 -103
- package/bin/docs/environment-variables.md +5 -3
- package/bin/docs/extensions.md +134 -2937
- package/bin/docs/how-knightcode-works.md +49 -0
- package/bin/docs/index.md +24 -69
- package/bin/docs/json.md +193 -65
- package/bin/docs/keybindings.md +56 -101
- package/bin/docs/llama-cpp.md +3 -3
- package/bin/docs/message-types.md +261 -0
- package/bin/docs/models.md +65 -517
- package/bin/docs/packages.md +66 -167
- package/bin/docs/prompt-templates.md +31 -68
- package/bin/docs/providers.md +103 -233
- package/bin/docs/quickstart.md +61 -106
- package/bin/docs/rpc-commands.md +854 -0
- package/bin/docs/rpc-extension-ui.md +200 -0
- package/bin/docs/rpc.md +129 -1556
- package/bin/docs/sdk.md +76 -1160
- package/bin/docs/security.md +70 -32
- package/bin/docs/session-format.md +39 -216
- package/bin/docs/sessions.md +43 -121
- package/bin/docs/settings.md +112 -367
- package/bin/docs/shell-aliases.md +85 -5
- package/bin/docs/skills.md +51 -189
- package/bin/docs/slash-commands.md +63 -0
- package/bin/docs/terminal-setup.md +107 -79
- package/bin/docs/termux.md +74 -83
- package/bin/docs/themes.md +68 -280
- package/bin/docs/tmux.md +31 -39
- package/bin/docs/tui.md +69 -923
- package/bin/docs/usage.md +79 -285
- package/bin/docs/windows.md +43 -17
- package/bin/export-html/template.js +6 -1
- package/bin/knightcode +2 -2
- package/bin/package.json +6 -6
- package/package.json +1 -1
- package/bin/docs/development.md +0 -71
package/bin/docs/providers.md
CHANGED
|
@@ -1,318 +1,188 @@
|
|
|
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. KnightCode 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 KnightCode.
|
|
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 dynamic `knightcode-messages` gateway. `/login radius` stores OAuth tokens in `auth.json`; the gateway catalog is refreshed independently and cached in `models-store.json`. Custom Radius gateways can be declared in `models.json` with `"oauth": "radius"` and a gateway `baseUrl`.
|
|
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 KnightCode should not store the key. Set the variable before starting KnightCode:
|
|
63
25
|
|
|
64
26
|
```bash
|
|
65
27
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
66
28
|
knightcode
|
|
67
29
|
```
|
|
68
30
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| ZAI Coding Plan (
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
| MiniMax
|
|
99
|
-
|
|
|
100
|
-
| Qwen Token Plan
|
|
101
|
-
| Qwen Token Plan (
|
|
102
|
-
|
|
|
103
|
-
| Xiaomi MiMo
|
|
104
|
-
| Xiaomi MiMo Token Plan (
|
|
105
|
-
| Xiaomi MiMo Token Plan (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Store credentials in `~/.knightcode/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
|
+
| AgentRouter | `AGENTROUTER_API_KEY` |
|
|
37
|
+
| Ant Ling | `ANT_LING_API_KEY` |
|
|
38
|
+
| OpenAI | `OPENAI_API_KEY` |
|
|
39
|
+
| DeepSeek | `DEEPSEEK_API_KEY` |
|
|
40
|
+
| NVIDIA NIM | `NVIDIA_API_KEY` |
|
|
41
|
+
| Google Gemini | `GEMINI_API_KEY` |
|
|
42
|
+
| GitHub Copilot | `COPILOT_GITHUB_TOKEN` |
|
|
43
|
+
| Mistral | `MISTRAL_API_KEY` |
|
|
44
|
+
| Groq | `GROQ_API_KEY` |
|
|
45
|
+
| Cerebras | `CEREBRAS_API_KEY` |
|
|
46
|
+
| xAI | `XAI_API_KEY` |
|
|
47
|
+
| OpenRouter | `OPENROUTER_API_KEY` |
|
|
48
|
+
| Vercel AI Gateway | `AI_GATEWAY_API_KEY` |
|
|
49
|
+
| ZAI Coding Plan (Global) | `ZAI_API_KEY` |
|
|
50
|
+
| ZAI Coding Plan (China) | `ZAI_CODING_CN_API_KEY` |
|
|
51
|
+
| OpenCode Zen and Go | `OPENCODE_API_KEY` |
|
|
52
|
+
| Radius | `RADIUS_API_KEY` |
|
|
53
|
+
| Hugging Face | `HF_TOKEN` |
|
|
54
|
+
| Fireworks | `FIREWORKS_API_KEY` |
|
|
55
|
+
| Together AI | `TOGETHER_API_KEY` |
|
|
56
|
+
| Baseten | `BASETEN_API_KEY` |
|
|
57
|
+
| Kimi For Coding | `KIMI_API_KEY` |
|
|
58
|
+
| Meta | `META_API_KEY` |
|
|
59
|
+
| MiniMax | `MINIMAX_API_KEY` |
|
|
60
|
+
| MiniMax (China) | `MINIMAX_CN_API_KEY` |
|
|
61
|
+
| Moonshot AI (Global and China) | `MOONSHOT_API_KEY` |
|
|
62
|
+
| Qwen Token Plan and Individual | `QWEN_TOKEN_PLAN_API_KEY` |
|
|
63
|
+
| Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
|
|
64
|
+
| Xiaomi MiMo | `XIAOMI_API_KEY` |
|
|
65
|
+
| Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
|
|
66
|
+
| Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` |
|
|
67
|
+
| Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` |
|
|
68
|
+
|
|
69
|
+
Anthropic also recognizes `ANTHROPIC_OAUTH_TOKEN` as an API credential and `ANTHROPIC_AUTH_TOKEN` as bearer authentication.
|
|
70
|
+
|
|
71
|
+
## Load an API key from a command
|
|
72
|
+
|
|
73
|
+
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 `!`:
|
|
113
74
|
|
|
114
75
|
```json
|
|
115
76
|
{
|
|
116
|
-
"anthropic": {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"nvidia": { "type": "api_key", "key": "nvapi-..." },
|
|
121
|
-
"google": { "type": "api_key", "key": "..." },
|
|
122
|
-
"opencode": { "type": "api_key", "key": "..." },
|
|
123
|
-
"opencode-go": { "type": "api_key", "key": "..." },
|
|
124
|
-
"together": { "type": "api_key", "key": "..." },
|
|
125
|
-
"qwen-token-plan": { "type": "api_key", "key": "sk-sp-..." },
|
|
126
|
-
"qwen-token-plan-individual": { "type": "api_key", "key": "sk-sp-..." },
|
|
127
|
-
"qwen-token-plan-cn": { "type": "api_key", "key": "sk-sp-..." },
|
|
128
|
-
"xiaomi": { "type": "api_key", "key": "..." },
|
|
129
|
-
"xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
|
|
130
|
-
"xiaomi-token-plan-ams": { "type": "api_key", "key": "..." },
|
|
131
|
-
"xiaomi-token-plan-sgp": { "type": "api_key", "key": "..." }
|
|
77
|
+
"anthropic": {
|
|
78
|
+
"type": "api_key",
|
|
79
|
+
"key": "!security find-generic-password -ws 'anthropic'"
|
|
80
|
+
}
|
|
132
81
|
}
|
|
133
82
|
```
|
|
134
83
|
|
|
135
|
-
|
|
136
|
-
`qwen-token-plan`, but limits the picker to the models documented for Individual subscriptions. The existing
|
|
137
|
-
provider keeps its broader catalog for backward compatibility. When using `auth.json`, store the
|
|
138
|
-
credential under the provider you select; an environment variable is shared by both international providers.
|
|
84
|
+
KnightCode 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 KnightCode restarts.
|
|
139
85
|
|
|
140
|
-
|
|
86
|
+
## Cloud Providers
|
|
87
|
+
|
|
88
|
+
The providers below need additional settings or can use credentials supplied by their cloud platform.
|
|
141
89
|
|
|
142
|
-
API
|
|
90
|
+
A stored API-key credential can include an `env` object. Its values take priority over the process environment for that provider:
|
|
143
91
|
|
|
144
92
|
```json
|
|
145
93
|
{
|
|
146
|
-
"cloudflare-ai
|
|
94
|
+
"cloudflare-workers-ai": {
|
|
147
95
|
"type": "api_key",
|
|
148
|
-
"key": "
|
|
96
|
+
"key": "...",
|
|
149
97
|
"env": {
|
|
150
|
-
"
|
|
151
|
-
"CLOUDFLARE_ACCOUNT_ID": "account-id",
|
|
152
|
-
"CLOUDFLARE_GATEWAY_ID": "gateway-id"
|
|
98
|
+
"CLOUDFLARE_ACCOUNT_ID": "account-id"
|
|
153
99
|
}
|
|
154
100
|
}
|
|
155
101
|
}
|
|
156
102
|
```
|
|
157
103
|
|
|
158
|
-
Use this when knightcode should use different provider settings than the project shell environment.
|
|
159
|
-
|
|
160
|
-
### Key Resolution
|
|
161
|
-
|
|
162
|
-
The `key` field supports command execution, environment interpolation, and literals:
|
|
163
|
-
|
|
164
|
-
- **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout (cached for process lifetime)
|
|
165
|
-
```json
|
|
166
|
-
{ "type": "api_key", "key": "!security find-generic-password -ws 'anthropic'" }
|
|
167
|
-
{ "type": "api_key", "key": "!op read 'op://vault/item/credential'" }
|
|
168
|
-
```
|
|
169
|
-
- **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
|
|
170
|
-
```json
|
|
171
|
-
{ "type": "api_key", "key": "$MY_ANTHROPIC_KEY" }
|
|
172
|
-
{ "type": "api_key", "key": "${KEY_PREFIX}_${KEY_SUFFIX}" }
|
|
173
|
-
```
|
|
174
|
-
`$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
|
|
175
|
-
- **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
|
|
176
|
-
```json
|
|
177
|
-
{ "type": "api_key", "key": "$$literal-dollar-prefix" }
|
|
178
|
-
{ "type": "api_key", "key": "$!literal-bang-prefix" }
|
|
179
|
-
```
|
|
180
|
-
- **Literal value:** Used directly. Plain uppercase strings such as `MY_API_KEY` are literals; use `$MY_API_KEY` for environment variables.
|
|
181
|
-
```json
|
|
182
|
-
{ "type": "api_key", "key": "sk-ant-..." }
|
|
183
|
-
{ "type": "api_key", "key": "public" }
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
OAuth credentials are also stored here after `/login` and managed automatically.
|
|
187
|
-
|
|
188
|
-
## Cloud Providers
|
|
189
|
-
|
|
190
104
|
### Azure OpenAI
|
|
191
105
|
|
|
106
|
+
Set an API key plus either a base URL or resource name:
|
|
107
|
+
|
|
192
108
|
```bash
|
|
193
109
|
export AZURE_OPENAI_API_KEY=...
|
|
194
110
|
export AZURE_OPENAI_BASE_URL=https://your-resource.ai.azure.com
|
|
195
|
-
#
|
|
196
|
-
# also supported: https://your-resource.openai.azure.com
|
|
197
|
-
# root endpoints are auto-normalized to /openai/v1
|
|
198
|
-
# or use resource name instead of base URL
|
|
111
|
+
# Or:
|
|
199
112
|
export AZURE_OPENAI_RESOURCE_NAME=your-resource
|
|
200
|
-
|
|
201
|
-
# Optional
|
|
202
|
-
export AZURE_OPENAI_API_VERSION=2024-02-01
|
|
203
|
-
export AZURE_OPENAI_DEPLOYMENT_NAME_MAP=gpt-4=my-gpt4,gpt-4o=my-gpt4o
|
|
204
113
|
```
|
|
205
114
|
|
|
115
|
+
Resource root URLs under `ai.azure.com`, `cognitiveservices.azure.com`, and `openai.azure.com` are normalized to the OpenAI API path.
|
|
116
|
+
|
|
206
117
|
### Amazon Bedrock
|
|
207
118
|
|
|
208
|
-
|
|
119
|
+
Bedrock can use a bearer token or an ambient AWS credential source:
|
|
209
120
|
|
|
210
121
|
```bash
|
|
211
|
-
#
|
|
122
|
+
# Named profile
|
|
212
123
|
export AWS_PROFILE=your-profile
|
|
213
124
|
|
|
214
|
-
#
|
|
125
|
+
# IAM keys
|
|
215
126
|
export AWS_ACCESS_KEY_ID=AKIA...
|
|
216
127
|
export AWS_SECRET_ACCESS_KEY=...
|
|
128
|
+
# Required for temporary credentials
|
|
129
|
+
export AWS_SESSION_TOKEN=...
|
|
217
130
|
|
|
218
|
-
#
|
|
131
|
+
# Bedrock bearer token
|
|
219
132
|
export AWS_BEARER_TOKEN_BEDROCK=...
|
|
220
133
|
|
|
221
|
-
#
|
|
134
|
+
# Region, when not supplied by the profile or AWS SDK configuration
|
|
222
135
|
export AWS_REGION=us-west-2
|
|
136
|
+
# AWS_DEFAULT_REGION is also supported
|
|
223
137
|
```
|
|
224
138
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
knightcode --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
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:
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
export AWS_BEDROCK_FORCE_CACHE=1
|
|
235
|
-
knightcode --provider amazon-bedrock --model arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
If you are connecting to a Bedrock API proxy, the following environment variables can be used:
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
# Set the URL for the Bedrock proxy (standard AWS SDK env var)
|
|
242
|
-
export AWS_ENDPOINT_URL_BEDROCK_RUNTIME=https://my.corp.proxy/bedrock
|
|
243
|
-
|
|
244
|
-
# Set if your proxy does not require authentication
|
|
245
|
-
export AWS_BEDROCK_SKIP_AUTH=1
|
|
246
|
-
|
|
247
|
-
# Set if your proxy only supports HTTP/1.1
|
|
248
|
-
export AWS_BEDROCK_FORCE_HTTP1=1
|
|
249
|
-
```
|
|
139
|
+
KnightCode also supports ECS task credentials and IRSA through the standard `AWS_CONTAINER_CREDENTIALS_*` and `AWS_WEB_IDENTITY_TOKEN_FILE` variables.
|
|
250
140
|
|
|
251
141
|
### Cloudflare AI Gateway
|
|
252
142
|
|
|
253
|
-
|
|
143
|
+
The gateway requires a token, account ID, and gateway ID:
|
|
254
144
|
|
|
255
145
|
```bash
|
|
256
|
-
export CLOUDFLARE_API_KEY=...
|
|
146
|
+
export CLOUDFLARE_API_KEY=...
|
|
257
147
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
258
|
-
export CLOUDFLARE_GATEWAY_ID=...
|
|
259
|
-
knightcode --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
|
|
148
|
+
export CLOUDFLARE_GATEWAY_ID=...
|
|
260
149
|
```
|
|
261
150
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. Upstream authentication can be one of:
|
|
265
|
-
|
|
266
|
-
| Mode | Request auth | Upstream auth |
|
|
267
|
-
|------|--------------|---------------|
|
|
268
|
-
| Workers AI | Cloudflare token only | Cloudflare-native |
|
|
269
|
-
| Unified billing | Cloudflare token only | Cloudflare handles upstream auth and deducts credits |
|
|
270
|
-
| Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
|
|
271
|
-
| Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
|
|
151
|
+
The account and gateway IDs can come from the process environment or the credential's `env` object in `auth.json`.
|
|
272
152
|
|
|
273
|
-
|
|
153
|
+
`CLOUDFLARE_API_KEY` authenticates KnightCode 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`.
|
|
274
154
|
|
|
275
155
|
### Cloudflare Workers AI
|
|
276
156
|
|
|
277
|
-
|
|
157
|
+
Workers AI requires a token and account ID:
|
|
278
158
|
|
|
279
159
|
```bash
|
|
280
|
-
export CLOUDFLARE_API_KEY=...
|
|
160
|
+
export CLOUDFLARE_API_KEY=...
|
|
281
161
|
export CLOUDFLARE_ACCOUNT_ID=...
|
|
282
|
-
knightcode --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
|
|
283
162
|
```
|
|
284
163
|
|
|
285
|
-
|
|
164
|
+
The account ID can also be stored in the credential's `env` object.
|
|
286
165
|
|
|
287
166
|
### Google Vertex AI
|
|
288
167
|
|
|
289
|
-
|
|
168
|
+
Use a Google Cloud API key:
|
|
290
169
|
|
|
291
170
|
```bash
|
|
292
|
-
|
|
293
|
-
export GOOGLE_CLOUD_PROJECT=your-project
|
|
294
|
-
export GOOGLE_CLOUD_LOCATION=us-central1
|
|
171
|
+
export GOOGLE_CLOUD_API_KEY=...
|
|
295
172
|
```
|
|
296
173
|
|
|
297
|
-
|
|
174
|
+
To use Application Default Credentials, configure a project and location:
|
|
298
175
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
## Custom Providers
|
|
306
|
-
|
|
307
|
-
**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).
|
|
308
|
-
|
|
309
|
-
**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/).
|
|
176
|
+
```bash
|
|
177
|
+
export GOOGLE_CLOUD_PROJECT=your-project
|
|
178
|
+
# GCLOUD_PROJECT is also supported
|
|
179
|
+
export GOOGLE_CLOUD_LOCATION=us-central1
|
|
180
|
+
```
|
|
310
181
|
|
|
311
|
-
|
|
182
|
+
Then authenticate:
|
|
312
183
|
|
|
313
|
-
|
|
184
|
+
```bash
|
|
185
|
+
gcloud auth application-default login
|
|
186
|
+
```
|
|
314
187
|
|
|
315
|
-
|
|
316
|
-
2. `auth.json` entry (API key or OAuth token)
|
|
317
|
-
3. Environment variable
|
|
318
|
-
4. Custom provider keys from `models.json`
|
|
188
|
+
To use a service-account key file instead, set `GOOGLE_APPLICATION_CREDENTIALS` along with the project and location.
|