docs/src/content/en/models/providers/berget.mdx
Access 8 Berget.AI models through Mastra's model router. Authentication is handled automatically using the BERGET_API_KEY environment variable.
Learn more in the Berget.AI documentation.
BERGET_API_KEY=your-api-key
import { Agent } from "@mastra/core/agent";
const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "berget/BAAI/bge-reranker-v2-m3"
});
// 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 Berget.AI documentation for details.
:::
<ProviderModelsTable models={[ { "model": "berget/BAAI/bge-reranker-v2-m3", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 512, "maxOutput": 512, "inputCost": 0.1, "outputCost": 0.1 }, { "model": "berget/intfloat/multilingual-e5-large", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 512, "maxOutput": 1024, "inputCost": 0.02, "outputCost": null }, { "model": "berget/intfloat/multilingual-e5-large-instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 512, "maxOutput": 1024, "inputCost": 0.02, "outputCost": null }, { "model": "berget/KBLab/kb-whisper-large", "imageInput": false, "audioInput": true, "videoInput": false, "toolUsage": false, "reasoning": false, "contextWindow": 480000, "maxOutput": 4800, "inputCost": 3, "outputCost": 3 }, { "model": "berget/meta-llama/Llama-3.3-70B-Instruct", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 8192, "inputCost": 0.9, "outputCost": 0.9 }, { "model": "berget/mistralai/Mistral-Small-3.2-24B-Instruct-2506", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 32000, "maxOutput": 8192, "inputCost": 0.3, "outputCost": 0.3 }, { "model": "berget/openai/gpt-oss-120b", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 8192, "inputCost": 0.3, "outputCost": 0.9 }, { "model": "berget/zai-org/GLM-4.7", "imageInput": false, "audioInput": false, "videoInput": false, "toolUsage": true, "reasoning": true, "contextWindow": 128000, "maxOutput": 8192, "inputCost": 0.7, "outputCost": 2.3 } ]} />
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://api.berget.ai/v1",
id: "berget/BAAI/bge-reranker-v2-m3",
apiKey: process.env.BERGET_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "berget/zai-org/GLM-4.7"
: "berget/BAAI/bge-reranker-v2-m3";
}
});