# ![302.AI logo](https://models.dev/logos/302ai.svg)302.AI Access 64 302.AI models through Mastra's model router. Authentication is handled automatically using the `302AI_API_KEY` environment variable. Learn more in the [302.AI documentation](https://doc.302.ai). ```bash 302AI_API_KEY=your-api-key ``` ```typescript import { Agent } from "@mastra/core/agent"; const agent = new Agent({ id: "my-agent", name: "My Agent", instructions: "You are a helpful assistant", model: "302ai/MiniMax-M1" }); // 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); } ``` Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [302.AI documentation](https://doc.302.ai) for details. ## Models | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M | | --------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- | | `302ai/chatgpt-4o-latest` | 128K | | | | | | $5 | $15 | | `302ai/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 | | `302ai/claude-opus-4-1-20250805` | 200K | | | | | | $15 | $75 | | `302ai/claude-opus-4-1-20250805-thinking` | 200K | | | | | | $15 | $75 | | `302ai/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 | | `302ai/claude-opus-4-5-20251101-thinking` | 200K | | | | | | $5 | $25 | | `302ai/claude-sonnet-4-5-20250929` | 200K | | | | | | $3 | $15 | | `302ai/claude-sonnet-4-5-20250929-thinking` | 200K | | | | | | $3 | $15 | | `302ai/deepseek-chat` | 128K | | | | | | $0.29 | $0.43 | | `302ai/deepseek-reasoner` | 128K | | | | | | $0.29 | $0.43 | | `302ai/deepseek-v3.2` | 128K | | | | | | $0.29 | $0.43 | | `302ai/deepseek-v3.2-thinking` | 128K | | | | | | $0.29 | $0.43 | | `302ai/doubao-seed-1-6-thinking-250715` | 256K | | | | | | $0.12 | $1 | | `302ai/doubao-seed-1-6-vision-250815` | 256K | | | | | | $0.11 | $1 | | `302ai/doubao-seed-1-8-251215` | 224K | | | | | | $0.11 | $0.29 | | `302ai/doubao-seed-code-preview-251028` | 256K | | | | | | $0.17 | $1 | | `302ai/gemini-2.0-flash-lite` | 2.0M | | | | | | $0.07 | $0.30 | | `302ai/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 | | `302ai/gemini-2.5-flash-image` | 33K | | | | | | $0.30 | $30 | | `302ai/gemini-2.5-flash-lite-preview-09-2025` | 1.0M | | | | | | $0.10 | $0.40 | | `302ai/gemini-2.5-flash-nothink` | 1.0M | | | | | | $0.30 | $3 | | `302ai/gemini-2.5-flash-preview-09-2025` | 1.0M | | | | | | $0.30 | $3 | | `302ai/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 | | `302ai/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 | | `302ai/gemini-3-pro-image-preview` | 33K | | | | | | $2 | $120 | | `302ai/gemini-3-pro-preview` | 1.0M | | | | | | $2 | $12 | | `302ai/glm-4.5` | 128K | | | | | | $0.29 | $1 | | `302ai/glm-4.5v` | 64K | | | | | | $0.29 | $0.86 | | `302ai/glm-4.6` | 200K | | | | | | $0.29 | $1 | | `302ai/glm-4.6v` | 128K | | | | | | $0.14 | $0.43 | | `302ai/glm-4.7` | 200K | | | | | | $0.29 | $1 | | `302ai/gpt-4.1` | 1.0M | | | | | | $2 | $8 | | `302ai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 | | `302ai/gpt-4.1-nano` | 1.0M | | | | | | $0.10 | $0.40 | | `302ai/gpt-4o` | 128K | | | | | | $3 | $10 | | `302ai/gpt-5` | 400K | | | | | | $1 | $10 | | `302ai/gpt-5-mini` | 400K | | | | | | $0.25 | $2 | | `302ai/gpt-5-pro` | 400K | | | | | | $15 | $120 | | `302ai/gpt-5-thinking` | 400K | | | | | | $1 | $10 | | `302ai/gpt-5.1` | 400K | | | | | | $1 | $10 | | `302ai/gpt-5.1-chat-latest` | 128K | | | | | | $1 | $10 | | `302ai/gpt-5.2` | 400K | | | | | | $2 | $14 | | `302ai/gpt-5.2-chat-latest` | 128K | | | | | | $2 | $14 | | `302ai/grok-4-1-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 | | `302ai/grok-4-1-fast-reasoning` | 2.0M | | | | | | $0.20 | $0.50 | | `302ai/grok-4-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 | | `302ai/grok-4-fast-reasoning` | 2.0M | | | | | | $0.20 | $0.50 | | `302ai/grok-4.1` | 200K | | | | | | $2 | $10 | | `302ai/kimi-k2-0905-preview` | 262K | | | | | | $0.63 | $3 | | `302ai/kimi-k2-thinking` | 262K | | | | | | $0.57 | $2 | | `302ai/kimi-k2-thinking-turbo` | 262K | | | | | | $1 | $9 | | `302ai/MiniMax-M1` | 1.0M | | | | | | $0.13 | $1 | | `302ai/MiniMax-M2` | 1.0M | | | | | | $0.33 | $1 | | `302ai/MiniMax-M2.1` | 1.0M | | | | | | $0.30 | $1 | | `302ai/ministral-14b-2512` | 128K | | | | | | $0.33 | $0.33 | | `302ai/mistral-large-2512` | 128K | | | | | | $1 | $3 | | `302ai/qwen-flash` | 1.0M | | | | | | $0.02 | $0.22 | | `302ai/qwen-max-latest` | 131K | | | | | | $0.34 | $1 | | `302ai/qwen-plus` | 1.0M | | | | | | $0.12 | $1 | | `302ai/qwen3-235b-a22b` | 128K | | | | | | $0.29 | $3 | | `302ai/qwen3-235b-a22b-instruct-2507` | 128K | | | | | | $0.29 | $1 | | `302ai/qwen3-30b-a3b` | 128K | | | | | | $0.11 | $1 | | `302ai/qwen3-coder-480b-a35b-instruct` | 262K | | | | | | $0.86 | $3 | | `302ai/qwen3-max-2025-09-23` | 258K | | | | | | $0.86 | $3 | ## Advanced Configuration ### Custom Headers ```typescript const agent = new Agent({ id: "custom-agent", name: "custom-agent", model: { url: "https://api.302.ai/v1", id: "302ai/MiniMax-M1", apiKey: process.env.302AI_API_KEY, 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 ? "302ai/qwen3-max-2025-09-23" : "302ai/MiniMax-M1"; } }); ```