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

ModelImageAudioVideoToolsStreamingContext Window
nebius/deepseek-ai/deepseek-v3131,072
nebius/meta-llama/llama-3_1-405b-instruct131,072
nebius/meta-llama/llama-3.3-70b-instruct-base131,072
nebius/meta-llama/llama-3.3-70b-instruct-fast131,072
nebius/moonshotai/kimi-k2-instruct131,072
nebius/NousResearch/hermes-4-405b131,072
nebius/NousResearch/hermes-4-70b131,072
nebius/nvidia/llama-3_1-nemotron-ultra-253b-v1131,072
nebius/openai/gpt-oss-120b131,072
nebius/openai/gpt-oss-20b131,072
nebius/qwen/qwen3-235b-a22b-instruct-2507262,144
nebius/qwen/qwen3-235b-a22b-thinking-2507262,144
nebius/qwen/qwen3-coder-480b-a35b-instruct262,144
nebius/zai-org/glm-4.5131,072
nebius/zai-org/glm-4.5-air131,072

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