Back to Mastra

Synthetic | Models

docs/src/content/en/models/providers/synthetic.mdx

2025-12-189.7 KB
Original Source

Synthetic

Access 28 Synthetic models through Mastra's model router. Authentication is handled automatically using the SYNTHETIC_API_KEY environment variable.

Learn more in the Synthetic documentation.

bash
SYNTHETIC_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: "synthetic/hf:MiniMaxAI/MiniMax-M2"
});

// 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 Synthetic documentation for details.

:::

Models

<ProviderModelsTable models={[ { "model": "synthetic/hf:deepseek-ai/DeepSeek-R1", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-R1-0528", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 3, "outputCost": 8 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-V3", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 1.25, "outputCost": 1.25 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-V3-0324", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 1.2, "outputCost": 1.2 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-V3.1", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 0.56, "outputCost": 1.68 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-V3.1-Terminus", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 1.2, "outputCost": 1.2 }, { "model": "synthetic/hf:deepseek-ai/DeepSeek-V3.2", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 162816, "maxOutput": 8000, "inputCost": 0.27, "outputCost": 0.4 }, { "model": "synthetic/hf:meta-llama/Llama-3.1-405B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 32768, "inputCost": 3, "outputCost": 3 }, { "model": "synthetic/hf:meta-llama/Llama-3.1-70B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 32768, "inputCost": 0.9, "outputCost": 0.9 }, { "model": "synthetic/hf:meta-llama/Llama-3.1-8B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 32768, "inputCost": 0.2, "outputCost": 0.2 }, { "model": "synthetic/hf:meta-llama/Llama-3.3-70B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 32768, "inputCost": 0.9, "outputCost": 0.9 }, { "model": "synthetic/hf:meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 524000, "maxOutput": 4096, "inputCost": 0.22, "outputCost": 0.88 }, { "model": "synthetic/hf:meta-llama/Llama-4-Scout-17B-16E-Instruct", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 328000, "maxOutput": 4096, "inputCost": 0.15, "outputCost": 0.6 }, { "model": "synthetic/hf:MiniMaxAI/MiniMax-M2", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 196608, "maxOutput": 131000, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:MiniMaxAI/MiniMax-M2.1", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 204800, "maxOutput": 131072, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:MiniMaxAI/MiniMax-M2.5", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 191488, "maxOutput": 65536, "inputCost": 0.6, "outputCost": 3 }, { "model": "synthetic/hf:moonshotai/Kimi-K2-Instruct-0905", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 32768, "inputCost": 1.2, "outputCost": 1.2 }, { "model": "synthetic/hf:moonshotai/Kimi-K2-Thinking", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 262144, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:moonshotai/Kimi-K2.5", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 65536, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:nvidia/Kimi-K2.5-NVFP4", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 65536, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:openai/gpt-oss-120b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 32768, "inputCost": 0.1, "outputCost": 0.1 }, { "model": "synthetic/hf:Qwen/Qwen2.5-Coder-32B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 32768, "maxOutput": 32768, "inputCost": 0.8, "outputCost": 0.8 }, { "model": "synthetic/hf:Qwen/Qwen3-235B-A22B-Instruct-2507", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 256000, "maxOutput": 32000, "inputCost": 0.2, "outputCost": 0.6 }, { "model": "synthetic/hf:Qwen/Qwen3-235B-A22B-Thinking-2507", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 256000, "maxOutput": 32000, "inputCost": 0.65, "outputCost": 3 }, { "model": "synthetic/hf:Qwen/Qwen3-Coder-480B-A35B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 256000, "maxOutput": 32000, "inputCost": 2, "outputCost": 2 }, { "model": "synthetic/hf:zai-org/GLM-4.6", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 200000, "maxOutput": 64000, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:zai-org/GLM-4.7", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 200000, "maxOutput": 64000, "inputCost": 0.55, "outputCost": 2.19 }, { "model": "synthetic/hf:zai-org/GLM-4.7-Flash", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 196608, "maxOutput": 65536, "inputCost": 0.06, "outputCost": 0.4 } ]} />

Advanced configuration

Custom headers

typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://api.synthetic.new/openai/v1",
    id: "synthetic/hf:MiniMaxAI/MiniMax-M2",
    apiKey: process.env.SYNTHETIC_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
      ? "synthetic/hf:zai-org/GLM-4.7-Flash"
      : "synthetic/hf:MiniMaxAI/MiniMax-M2";
  }
});