Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Netlify

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

Learn more in the Netlify documentation.

UsageDirect link to Usage

import { Agent } from "@mastra/core";

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

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Netlify documentation for details.

ConfigurationDirect link to Configuration

# Use gateway API key
NETLIFY_API_KEY=your-gateway-key

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

Available ModelsDirect link to Available Models

Model
anthropic/claude-3-5-haiku-20241022
anthropic/claude-3-7-sonnet-20250219
anthropic/claude-3-haiku-20240307
anthropic/claude-haiku-4-5-20251001
anthropic/claude-opus-4-1-20250805
anthropic/claude-opus-4-20250514
anthropic/claude-opus-4-5-20251101
anthropic/claude-sonnet-4-20250514
anthropic/claude-sonnet-4-5-20250929
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-image-preview
gemini/gemini-2.5-flash-lite
gemini/gemini-2.5-flash-lite-preview-09-2025
gemini/gemini-2.5-flash-preview-09-2025
gemini/gemini-2.5-pro
gemini/gemini-3-pro-image-preview
gemini/gemini-3-pro-preview
gemini/gemini-flash-latest
gemini/gemini-flash-lite-latest
openai/codex-mini-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-mini
openai/o3
openai/o3-mini
openai/o4-mini

On this page