Skip to main content

Nebius AI Studio logoNebius AI Studio

Access 15 Nebius AI Studio models through Mastra's model router. Authentication is handled automatically using the NEBIUS_API_KEY environment variable.

Learn more in the Nebius AI Studio documentation.

NEBIUS_API_KEY=your-api-key
import { Agent } from "@mastra/core";

const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "nebius/NousResearch/hermes-4-405b"
});

// 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 Nebius AI Studio documentation for details.

Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
nebius/deepseek-ai/deepseek-v3131K$0.50$2
nebius/meta-llama/llama-3_1-405b-instruct131K$1$3
nebius/meta-llama/llama-3.3-70b-instruct-base131K$0.13$0.40
nebius/meta-llama/llama-3.3-70b-instruct-fast131K$0.25$0.75
nebius/moonshotai/kimi-k2-instruct131K$0.50$2
nebius/NousResearch/hermes-4-405b131K$1$3
nebius/NousResearch/hermes-4-70b131K$0.13$0.40
nebius/nvidia/llama-3_1-nemotron-ultra-253b-v1131K$0.60$2
nebius/openai/gpt-oss-120b131K$0.15$0.60
nebius/openai/gpt-oss-20b131K$0.05$0.20
nebius/qwen/qwen3-235b-a22b-instruct-2507262K$0.20$0.60
nebius/qwen/qwen3-235b-a22b-thinking-2507262K$0.20$0.80
nebius/qwen/qwen3-coder-480b-a35b-instruct262K$0.40$2
nebius/zai-org/glm-4.5131K$0.60$2
nebius/zai-org/glm-4.5-air131K$0.20$1
15 available models

Advanced Configuration

Custom Headers

const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.studio.nebius.com/v1/",
id: "nebius/NousResearch/hermes-4-405b",
apiKey: process.env.NEBIUS_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic Model Selection

const agent = new Agent({
name: "dynamic-agent",
model: ({ runtimeContext }) => {
const useAdvanced = runtimeContext.task === "complex";
return useAdvanced
? "nebius/zai-org/glm-4.5-air"
: "nebius/NousResearch/hermes-4-405b";
}
});

On this page