# <img src="https://models.dev/logos/fireworks-ai.svg" alt="Fireworks AI logo" className="inline w-8 h-8 mr-2 align-middle dark:invert dark:brightness-0 dark:contrast-200" />Fireworks AI
[EN] Source: https://mastra.ai/models/providers/fireworks-ai

Access 10 Fireworks AI models through Mastra's model router. Authentication is handled automatically using the `FIREWORKS_API_KEY` environment variable.

Learn more in the [Fireworks AI documentation](https://fireworks.ai/docs/).

```bash
FIREWORKS_API_KEY=your-api-key
```

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

const agent = new Agent({
  name: "my-agent",
  instructions: "You are a helpful assistant",
  model: "fireworks-ai/accounts/fireworks/models/deepseek-r1-0528"
});

// 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 [Fireworks AI documentation](https://fireworks.ai/docs/) for details.

:::

## Models

<ProviderModelsTable
  models={[
  {
    "model": "fireworks-ai/accounts/fireworks/models/deepseek-r1-0528",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 160000,
    "maxOutput": 16384,
    "inputCost": 3,
    "outputCost": 8
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/deepseek-v3-0324",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 160000,
    "maxOutput": 16384,
    "inputCost": 0.9,
    "outputCost": 0.9
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/deepseek-v3p1",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 163840,
    "maxOutput": 163840,
    "inputCost": 0.56,
    "outputCost": 1.68
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/glm-4p5",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 131072,
    "inputCost": 0.55,
    "outputCost": 2.19
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/glm-4p5-air",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 131072,
    "inputCost": 0.22,
    "outputCost": 0.88
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/gpt-oss-120b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.15,
    "outputCost": 0.6
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/gpt-oss-20b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.05,
    "outputCost": 0.2
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/kimi-k2-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 128000,
    "maxOutput": 16384,
    "inputCost": 1,
    "outputCost": 3
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/minimax-m2",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 16384,
    "inputCost": 0.3,
    "outputCost": 1.2
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/qwen3-235b-a22b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 16384,
    "inputCost": 0.22,
    "outputCost": 0.88
  },
  {
    "model": "fireworks-ai/accounts/fireworks/models/qwen3-coder-480b-a35b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 256000,
    "maxOutput": 32768,
    "inputCost": 0.45,
    "outputCost": 1.8
  }
]}
/>

## Advanced Configuration

### Custom Headers

```typescript
const agent = new Agent({
  name: "custom-agent",
  model: {
    url: "https://api.fireworks.ai/inference/v1/",
    id: "fireworks-ai/accounts/fireworks/models/deepseek-r1-0528",
    apiKey: process.env.FIREWORKS_API_KEY,
    headers: {
      "X-Custom-Header": "value"
    }
  }
});
```

### Dynamic Model Selection

```typescript
const agent = new Agent({
  name: "dynamic-agent",
  model: ({ runtimeContext }) => {
    const useAdvanced = runtimeContext.task === "complex";
    return useAdvanced
      ? "fireworks-ai/accounts/fireworks/models/qwen3-coder-480b-a35b-instruct"
      : "fireworks-ai/accounts/fireworks/models/deepseek-r1-0528";
  }
});
```




---
title: "GitHub Models | Models | Mastra"
description: "Use GitHub Models models with Mastra. 55 models available."
---

{/* This file is auto-generated by generate-model-docs.ts - DO NOT EDIT MANUALLY */}