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

Access 10 Weights & Biases models through Mastra's model router. Authentication is handled automatically using the `WANDB_API_KEY` environment variable.

Learn more in the [Weights & Biases documentation](https://weave-docs.wandb.ai).

```bash
WANDB_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: "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507"
});

// 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 [Weights & Biases documentation](https://weave-docs.wandb.ai) for details.

:::

## Models

<ProviderModelsTable
  models={[
  {
    "model": "wandb/deepseek-ai/DeepSeek-R1-0528",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 161000,
    "maxOutput": 163840,
    "inputCost": 1.35,
    "outputCost": 5.4
  },
  {
    "model": "wandb/deepseek-ai/DeepSeek-V3-0324",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 161000,
    "maxOutput": 8192,
    "inputCost": 1.14,
    "outputCost": 2.75
  },
  {
    "model": "wandb/meta-llama/Llama-3.1-8B-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 32768,
    "inputCost": 0.22,
    "outputCost": 0.22
  },
  {
    "model": "wandb/meta-llama/Llama-3.3-70B-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 32768,
    "inputCost": 0.71,
    "outputCost": 0.71
  },
  {
    "model": "wandb/meta-llama/Llama-4-Scout-17B-16E-Instruct",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 64000,
    "maxOutput": 8192,
    "inputCost": 0.17,
    "outputCost": 0.66
  },
  {
    "model": "wandb/microsoft/Phi-4-mini-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 128000,
    "maxOutput": 4096,
    "inputCost": 0.08,
    "outputCost": 0.35
  },
  {
    "model": "wandb/moonshotai/Kimi-K2-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 128000,
    "maxOutput": 16384,
    "inputCost": 1.35,
    "outputCost": 4
  },
  {
    "model": "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 131072,
    "inputCost": 0.1,
    "outputCost": 0.1
  },
  {
    "model": "wandb/Qwen/Qwen3-235B-A22B-Thinking-2507",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 262144,
    "maxOutput": 131072,
    "inputCost": 0.1,
    "outputCost": 0.1
  },
  {
    "model": "wandb/Qwen/Qwen3-Coder-480B-A35B-Instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 66536,
    "inputCost": 1,
    "outputCost": 1.5
  }
]}
/>

## Advanced Configuration

### Custom Headers

```typescript
const agent = new Agent({
  name: "custom-agent",
  model: {
    url: "https://api.inference.wandb.ai/v1",
    id: "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507",
    apiKey: process.env.WANDB_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
      ? "wandb/moonshotai/Kimi-K2-Instruct"
      : "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507";
  }
});
```




---
title: "xAI | Models | Mastra"
description: "Use xAI models with Mastra. 20 models available."
---

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



import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";