@netlify/agent-runner-cli 1.198.0-PAW-740.0 → 1.199.0
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/dist/bin-local.js +213 -216
- package/dist/bin.js +331 -334
- package/dist/connections-mcp-server.js +23 -23
- package/dist/index.d.ts +4 -0
- package/dist/index.js +220 -223
- package/dist/interactions-mcp-server.js +18 -12
- package/dist/skills/netlify-ai-gateway/SKILL.md +19 -26
- package/package.json +1 -1
|
@@ -27,6 +27,14 @@ Gemini variables independently.
|
|
|
27
27
|
|
|
28
28
|
AI Gateway requires a **credit-based plan** (Free, Personal, or Pro). It is not available on legacy pricing plans.
|
|
29
29
|
|
|
30
|
+
### Rules
|
|
31
|
+
|
|
32
|
+
- Use the provider SDK with a default constructor (`new Anthropic()`, `new OpenAI()`, `new GoogleGenAI({})`). Don't
|
|
33
|
+
pass `apiKey` or `baseURL`, except in the Image Generation example below.
|
|
34
|
+
- Don't write checks that return an error when an API key variable is missing, and don't ask the user for an API key.
|
|
35
|
+
Netlify sets the keys at runtime.
|
|
36
|
+
- Use `fetch` only when no official SDK covers the call.
|
|
37
|
+
|
|
30
38
|
### Environment Variables
|
|
31
39
|
|
|
32
40
|
| Provider | Variables |
|
|
@@ -35,7 +43,7 @@ AI Gateway requires a **credit-based plan** (Free, Personal, or Pro). It is not
|
|
|
35
43
|
| **OpenAI** | `OPENAI_API_KEY`, `OPENAI_BASE_URL` |
|
|
36
44
|
| **Google Gemini** | `GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL` |
|
|
37
45
|
| **Typesafe** | `TYPESAFE_API_KEY`, `TYPESAFE_BASE_URL` |
|
|
38
|
-
| **Gateway (always set)** | `NETLIFY_AI_GATEWAY_KEY`, `
|
|
46
|
+
| **Gateway (always set)** | `NETLIFY_AI_GATEWAY_KEY`, `NETLIFY_AI_GATEWAY_URL` |
|
|
39
47
|
|
|
40
48
|
## Quick Start
|
|
41
49
|
|
|
@@ -228,7 +236,7 @@ import { GoogleGenAI } from '@google/genai'
|
|
|
228
236
|
|
|
229
237
|
const ai = new GoogleGenAI({
|
|
230
238
|
apiKey: process.env.NETLIFY_AI_GATEWAY_KEY,
|
|
231
|
-
httpOptions: { baseUrl: process.env.
|
|
239
|
+
httpOptions: { baseUrl: process.env.NETLIFY_AI_GATEWAY_URL?.replace(/\/$/, '') },
|
|
232
240
|
})
|
|
233
241
|
|
|
234
242
|
const response = await ai.models.generateContent({
|
|
@@ -358,10 +366,12 @@ This also works in server components, API routes in Astro, Remix loaders/actions
|
|
|
358
366
|
|
|
359
367
|
## REST API / Direct Fetch
|
|
360
368
|
|
|
361
|
-
|
|
369
|
+
Only when no official SDK covers the call. Use the gateway variables; the URL ends with a slash:
|
|
362
370
|
|
|
363
371
|
```typescript
|
|
364
|
-
const
|
|
372
|
+
const gatewayUrl = process.env.NETLIFY_AI_GATEWAY_URL.replace(/\/$/, '')
|
|
373
|
+
|
|
374
|
+
const response = await fetch(`${gatewayUrl}/anthropic/v1/messages`, {
|
|
365
375
|
method: 'POST',
|
|
366
376
|
headers: {
|
|
367
377
|
'Content-Type': 'application/json',
|
|
@@ -378,24 +388,6 @@ const response = await fetch(`${process.env.NETLIFY_AI_GATEWAY_BASE_URL}/anthrop
|
|
|
378
388
|
const data = await response.json()
|
|
379
389
|
```
|
|
380
390
|
|
|
381
|
-
Or using the provider-specific variables with `fetch`:
|
|
382
|
-
|
|
383
|
-
```typescript
|
|
384
|
-
const response = await fetch(`${process.env.ANTHROPIC_BASE_URL}/v1/messages`, {
|
|
385
|
-
method: 'POST',
|
|
386
|
-
headers: {
|
|
387
|
-
'Content-Type': 'application/json',
|
|
388
|
-
'x-api-key': process.env.ANTHROPIC_API_KEY,
|
|
389
|
-
'anthropic-version': '2023-06-01',
|
|
390
|
-
},
|
|
391
|
-
body: JSON.stringify({
|
|
392
|
-
model: 'claude-opus-4-8',
|
|
393
|
-
max_tokens: 1024,
|
|
394
|
-
messages: [{ role: 'user', content: 'Hello!' }],
|
|
395
|
-
}),
|
|
396
|
-
})
|
|
397
|
-
```
|
|
398
|
-
|
|
399
391
|
## Available Models
|
|
400
392
|
|
|
401
393
|
<!-- AVAILABLE_MODELS -->
|
|
@@ -427,13 +419,14 @@ token consumption is tracked per model and converted to Netlify credits.
|
|
|
427
419
|
|
|
428
420
|
### "API key not found" or env var is undefined
|
|
429
421
|
|
|
430
|
-
**Cause:** AI Gateway env vars are not injected.
|
|
422
|
+
**Cause:** AI Gateway env vars are not injected, or the code reads a variable the runtime doesn't set.
|
|
431
423
|
|
|
432
424
|
**Fix:**
|
|
433
425
|
|
|
434
|
-
1.
|
|
435
|
-
2.
|
|
436
|
-
3.
|
|
426
|
+
1. Check the function uses v2 or v3 syntax, not a v1 `exports.handler`
|
|
427
|
+
2. Check the code reads only the variable names in the Environment Variables table above
|
|
428
|
+
3. Ensure the site has at least one production deploy
|
|
429
|
+
4. Check that you are reading the env var in server-side code, not client-side browser code
|
|
437
430
|
|
|
438
431
|
### Rate limit exceeded (429)
|
|
439
432
|
|