# Netlify

Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 66 models through Mastra's model router.

Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).

## Usage

```typescript
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
  id: "my-agent",
  name: "My Agent",
  instructions: "You are a helpful assistant",
  model: "netlify/anthropic/claude-haiku-4-5"
});
```

> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/) for details.

## Configuration

```bash
# Use gateway API key
NETLIFY_TOKEN=your-netlify-token
NETLIFY_SITE_ID=your-netlify-site-id

# Or use provider API keys directly
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=ant-...
```

## Available models

| Model                                       |
| ------------------------------------------- |
| `anthropic/claude-haiku-4-5`                |
| `anthropic/claude-haiku-4-5-20251001`       |
| `anthropic/claude-opus-4-1-20250805`        |
| `anthropic/claude-opus-4-20250514`          |
| `anthropic/claude-opus-4-5`                 |
| `anthropic/claude-opus-4-5-20251101`        |
| `anthropic/claude-opus-4-6`                 |
| `anthropic/claude-opus-4-7`                 |
| `anthropic/claude-sonnet-4-0`               |
| `anthropic/claude-sonnet-4-20250514`        |
| `anthropic/claude-sonnet-4-5`               |
| `anthropic/claude-sonnet-4-5-20250929`      |
| `anthropic/claude-sonnet-4-6`               |
| `gemini/gemini-2.0-flash`                   |
| `gemini/gemini-2.0-flash-lite`              |
| `gemini/gemini-2.5-flash`                   |
| `gemini/gemini-2.5-flash-image`             |
| `gemini/gemini-2.5-flash-lite`              |
| `gemini/gemini-2.5-pro`                     |
| `gemini/gemini-3-flash-preview`             |
| `gemini/gemini-3-pro-image-preview`         |
| `gemini/gemini-3.1-flash-image-preview`     |
| `gemini/gemini-3.1-flash-lite-preview`      |
| `gemini/gemini-3.1-pro-preview`             |
| `gemini/gemini-3.1-pro-preview-customtools` |
| `gemini/gemini-flash-latest`                |
| `gemini/gemini-flash-lite-latest`           |
| `openai/gpt-4.1`                            |
| `openai/gpt-4.1-mini`                       |
| `openai/gpt-4.1-nano`                       |
| `openai/gpt-4o`                             |
| `openai/gpt-4o-mini`                        |
| `openai/gpt-5`                              |
| `openai/gpt-5-2025-08-07`                   |
| `openai/gpt-5-codex`                        |
| `openai/gpt-5-mini`                         |
| `openai/gpt-5-mini-2025-08-07`              |
| `openai/gpt-5-nano`                         |
| `openai/gpt-5-pro`                          |
| `openai/gpt-5.1`                            |
| `openai/gpt-5.1-2025-11-13`                 |
| `openai/gpt-5.1-codex`                      |
| `openai/gpt-5.1-codex-max`                  |
| `openai/gpt-5.1-codex-mini`                 |
| `openai/gpt-5.2`                            |
| `openai/gpt-5.2-2025-12-11`                 |
| `openai/gpt-5.2-codex`                      |
| `openai/gpt-5.2-pro`                        |
| `openai/gpt-5.2-pro-2025-12-11`             |
| `openai/gpt-5.3-chat-latest`                |
| `openai/gpt-5.3-codex`                      |
| `openai/gpt-5.4`                            |
| `openai/gpt-5.4-2026-03-05`                 |
| `openai/gpt-5.4-mini`                       |
| `openai/gpt-5.4-mini-2026-03-17`            |
| `openai/gpt-5.4-nano`                       |
| `openai/gpt-5.4-nano-2026-03-17`            |
| `openai/gpt-5.4-pro`                        |
| `openai/gpt-5.4-pro-2026-03-05`             |
| `openai/gpt-5.5`                            |
| `openai/gpt-5.5-2026-04-23`                 |
| `openai/gpt-5.5-pro`                        |
| `openai/gpt-5.5-pro-2026-04-23`             |
| `openai/o3`                                 |
| `openai/o3-mini`                            |
| `openai/o4-mini`                            |