Back to Mastra

Ollama Cloud | Models

docs/src/content/en/models/providers/ollama-cloud.mdx

2025-12-1811.0 KB
Original Source

Ollama Cloud

Access 34 Ollama Cloud models through Mastra's model router. Authentication is handled automatically using the OLLAMA_API_KEY environment variable.

Learn more in the Ollama Cloud documentation.

bash
OLLAMA_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: "ollama-cloud/cogito-2.1:671b"
});

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

:::

Models

<ProviderModelsTable models={[ { "model": "ollama-cloud/cogito-2.1:671b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 163840, "maxOutput": 32000, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/deepseek-v3.1:671b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 163840, "maxOutput": 163840, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/deepseek-v3.2", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 163840, "maxOutput": 65536, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/devstral-2:123b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/devstral-small-2:24b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gemini-3-flash-preview", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 1048576, "maxOutput": 65536, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gemma3:12b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 131072, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gemma3:27b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 131072, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gemma3:4b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 131072, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/glm-4.6", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 202752, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/glm-4.7", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 202752, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/glm-5", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 202752, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gpt-oss:120b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 131072, "maxOutput": 32768, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/gpt-oss:20b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 131072, "maxOutput": 32768, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/kimi-k2-thinking", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/kimi-k2:1t", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/kimi-k2.5", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/minimax-m2", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 204800, "maxOutput": 128000, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/minimax-m2.1", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 204800, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/minimax-m2.5", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 204800, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/minimax-m2.7", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 204800, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/ministral-3:14b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 128000, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/ministral-3:3b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 128000, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/ministral-3:8b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 128000, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/mistral-large-3:675b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 262144, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/nemotron-3-nano:30b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 1048576, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/nemotron-3-super", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 65536, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3-coder-next", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 65536, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3-coder:480b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 65536, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3-next:80b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 32768, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3-vl:235b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 32768, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3-vl:235b-instruct", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 262144, "maxOutput": 131072, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/qwen3.5:397b", "imageInput": true, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 262144, "maxOutput": 81920, "inputCost": null, "outputCost": null }, { "model": "ollama-cloud/rnj-1:8b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": false, "contextWindow": 32768, "maxOutput": 4096, "inputCost": null, "outputCost": null } ]} />

Advanced configuration

Custom headers

typescript
const agent = new Agent({
  id: "custom-agent",
  name: "custom-agent",
  model: {
    url: "https://ollama.com/v1",
    id: "ollama-cloud/cogito-2.1:671b",
    apiKey: process.env.OLLAMA_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
      ? "ollama-cloud/rnj-1:8b"
      : "ollama-cloud/cogito-2.1:671b";
  }
});