Back to Mastra

Weights & Biases | Models

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

2025-12-186.6 KB
Original Source

Weights & Biases

Access 17 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.

bash
WANDB_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: "wandb/MiniMaxAI/MiniMax-M2.5"
});

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

:::

Models

<ProviderModelsTable models={[ { "model": "wandb/deepseek-ai/DeepSeek-V3.1", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 161000, "maxOutput": 161000, "inputCost": 0.55, "outputCost": 1.65 }, { "model": "wandb/meta-llama/Llama-3.1-70B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 128000, "maxOutput": 128000, "inputCost": 0.8, "outputCost": 0.8 }, { "model": "wandb/meta-llama/Llama-3.1-8B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 128000, "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": 128000, "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": 64000, "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": 128000, "inputCost": 0.08, "outputCost": 0.35 }, { "model": "wandb/MiniMaxAI/MiniMax-M2.5", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 196608, "maxOutput": 196608, "inputCost": 0.3, "outputCost": 1.2 }, { "model": "wandb/moonshotai/Kimi-K2.5", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 262144, "inputCost": 0.5, "outputCost": 2.85 }, { "model": "wandb/nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-FP8", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": 0.2, "outputCost": 0.8 }, { "model": "wandb/openai/gpt-oss-120b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 131072, "maxOutput": 131072, "inputCost": 0.15, "outputCost": 0.6 }, { "model": "wandb/openai/gpt-oss-20b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 131072, "maxOutput": 131072, "inputCost": 0.05, "outputCost": 0.2 }, { "model": "wandb/OpenPipe/Qwen3-14B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 32768, "maxOutput": 32768, "inputCost": 0.05, "outputCost": 0.22 }, { "model": "wandb/Qwen/Qwen3-235B-A22B-Instruct-2507", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "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": 262144, "inputCost": 0.1, "outputCost": 0.1 }, { "model": "wandb/Qwen/Qwen3-30B-A3B-Instruct-2507", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": 0.1, "outputCost": 0.3 }, { "model": "wandb/Qwen/Qwen3-Coder-480B-A35B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": 1, "outputCost": 1.5 }, { "model": "wandb/zai-org/GLM-5-FP8", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 200000, "maxOutput": 200000, "inputCost": 1, "outputCost": 3.2 } ]} />

Advanced configuration

Custom headers

typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://api.inference.wandb.ai/v1",
    id: "wandb/MiniMaxAI/MiniMax-M2.5",
    apiKey: process.env.WANDB_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
      ? "wandb/zai-org/GLM-5-FP8"
      : "wandb/MiniMaxAI/MiniMax-M2.5";
  }
});