# ![Neon logo](https://models.dev/logos/neon.svg)Neon Access 25 Neon models through Mastra's model router. Authentication is handled automatically using the `NEON_AI_GATEWAY_TOKEN` environment variable. Configure `NEON_AI_GATEWAY_BASE_URL` as well. Learn more in the [Neon documentation](https://neon.com/docs). ```bash NEON_AI_GATEWAY_BASE_URL=your-value NEON_AI_GATEWAY_TOKEN=your-api-token ``` ```typescript import { Agent } from "@mastra/core/agent"; const agent = new Agent({ id: "my-agent", name: "My Agent", instructions: "You are a helpful assistant", model: "neon/claude-haiku-4-5" }); // Generate a response const response = await agent.generate("Hello!"); // Stream a response const stream = await agent.stream("Tell me a story"); for await (const chunk of stream) { console.log(chunk); } ``` > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Neon documentation](https://neon.com/docs) for details. ## Models | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | ---------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `neon/claude-haiku-4-5` | 200K | | | | | | $1 | $5 | | `neon/claude-opus-4-1` | 200K | | | | | | $15 | $75 | | `neon/claude-opus-4-5` | 200K | | | | | | $5 | $25 | | `neon/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 | | `neon/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 | | `neon/claude-sonnet-4` | 200K | | | | | | $3 | $15 | | `neon/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 | | `neon/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 | | `neon/gemini-2-5-flash` | 1.0M | | | | | | $0.30 | $3 | | `neon/gemini-2-5-pro` | 1.0M | | | | | | $1 | $10 | | `neon/gemini-3-1-flash-lite` | 1.0M | | | | | | $0.25 | $2 | | `neon/gemini-3-1-pro` | 1.0M | | | | | | $2 | $12 | | `neon/gemini-3-flash` | 1.0M | | | | | | $0.50 | $3 | | `neon/gemini-3-pro` | 1.0M | | | | | | $2 | $12 | | `neon/gpt-5` | 400K | | | | | | $1 | $10 | | `neon/gpt-5-1` | 400K | | | | | | $1 | $10 | | `neon/gpt-5-2` | 400K | | | | | | $2 | $14 | | `neon/gpt-5-4` | 1.1M | | | | | | $3 | $15 | | `neon/gpt-5-4-mini` | 400K | | | | | | $0.75 | $5 | | `neon/gpt-5-4-nano` | 400K | | | | | | $0.20 | $1 | | `neon/gpt-5-5` | 1.1M | | | | | | $5 | $30 | | `neon/gpt-5-mini` | 400K | | | | | | $0.25 | $2 | | `neon/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 | | `neon/gpt-oss-120b` | 131K | | | | | | $0.07 | $0.28 | | `neon/gpt-oss-20b` | 131K | | | | | | $0.05 | $0.20 | ## Advanced configuration ### Custom headers ```typescript const agent = new Agent({ id: "custom-agent", name: "custom-agent", model: { url: "${NEON_AI_GATEWAY_BASE_URL}/ai-gateway/mlflow/v1", id: "neon/claude-haiku-4-5", apiKey: process.env.NEON_AI_GATEWAY_TOKEN, headers: { "X-Custom-Header": "value" } } }); ``` ### Dynamic model selection ```typescript const agent = new Agent({ id: "dynamic-agent", name: "Dynamic Agent", model: ({ requestContext }) => { const useAdvanced = requestContext.task === "complex"; return useAdvanced ? "neon/gpt-oss-20b" : "neon/claude-haiku-4-5"; } }); ```