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

Access 14 Hugging Face models through Mastra's model router. Authentication is handled automatically using the `HF_TOKEN` environment variable.

Learn more in the [Hugging Face documentation](https://huggingface.co).

```bash
HF_TOKEN=your-api-key
```

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

const agent = new Agent({
  name: "my-agent",
  instructions: "You are a helpful assistant",
  model: "huggingface/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 [Hugging Face documentation](https://huggingface.co) for details.

:::

## Models

<ProviderModelsTable
  models={[
  {
    "model": "huggingface/deepseek-ai/DeepSeek-R1-0528",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 163840,
    "maxOutput": 163840,
    "inputCost": 3,
    "outputCost": 5
  },
  {
    "model": "huggingface/deepseek-ai/Deepseek-V3-0324",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 16384,
    "maxOutput": 8192,
    "inputCost": 1.25,
    "outputCost": 1.25
  },
  {
    "model": "huggingface/MiniMaxAI/MiniMax-M2",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 204800,
    "maxOutput": 204800,
    "inputCost": 0.3,
    "outputCost": 1.2
  },
  {
    "model": "huggingface/moonshotai/Kimi-K2-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 16384,
    "inputCost": 1,
    "outputCost": 3
  },
  {
    "model": "huggingface/moonshotai/Kimi-K2-Instruct-0905",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 16384,
    "inputCost": 1,
    "outputCost": 3
  },
  {
    "model": "huggingface/Qwen/Qwen3-235B-A22B-Thinking-2507",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 262144,
    "maxOutput": 131072,
    "inputCost": 0.3,
    "outputCost": 3
  },
  {
    "model": "huggingface/Qwen/Qwen3-Coder-480B-A35B-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 66536,
    "inputCost": 2,
    "outputCost": 2
  },
  {
    "model": "huggingface/Qwen/Qwen3-Embedding-4B",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 32000,
    "maxOutput": 2048,
    "inputCost": 0.01,
    "outputCost": null
  },
  {
    "model": "huggingface/Qwen/Qwen3-Embedding-8B",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 32000,
    "maxOutput": 4096,
    "inputCost": 0.01,
    "outputCost": null
  },
  {
    "model": "huggingface/Qwen/Qwen3-Next-80B-A3B-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 66536,
    "inputCost": 0.25,
    "outputCost": 1
  },
  {
    "model": "huggingface/Qwen/Qwen3-Next-80B-A3B-Thinking",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 131072,
    "inputCost": 0.3,
    "outputCost": 2
  },
  {
    "model": "huggingface/zai-org/GLM-4.5",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 98304,
    "inputCost": 0.6,
    "outputCost": 2.2
  },
  {
    "model": "huggingface/zai-org/GLM-4.5-Air",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 96000,
    "inputCost": 0.2,
    "outputCost": 1.1
  },
  {
    "model": "huggingface/zai-org/GLM-4.6",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 200000,
    "maxOutput": 128000,
    "inputCost": 0.6,
    "outputCost": 2.2
  }
]}
/>

## Advanced Configuration

### Custom Headers

```typescript
const agent = new Agent({
  name: "custom-agent",
  model: {
    url: "https://router.huggingface.co/v1",
    id: "huggingface/MiniMaxAI/MiniMax-M2",
    apiKey: process.env.HF_TOKEN,
    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
      ? "huggingface/zai-org/GLM-4.6"
      : "huggingface/MiniMaxAI/MiniMax-M2";
  }
});
```




---
title: "Inception | Models | Mastra"
description: "Use Inception models with Mastra. 2 models available."
---

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