Skip to main content

LLMTR logoLLMTR

Access 32 LLMTR models through Mastra's model router. Authentication is handled automatically using the LLMTR_API_KEY environment variable.

Learn more in the LLMTR documentation.

.env
LLMTR_API_KEY=your-api-key
src/mastra/agents/my-agent.ts
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "llmtr/gemma-4"
});

// 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);
}
note

Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the LLMTR documentation for details.

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
llmtr/gemma-4131K$2$5
llmtr/google/gemini-2.5-flash-lite1.0M$0.10$0.10
llmtr/magibu-11b-v88K$0.10$0.50
llmtr/meta/muse-spark-1.2-contributor1.0M$0.10$0.20
llmtr/mimo/mimo-v2.51.0M$0.14$0.28
llmtr/mimo/mimo-v2.5-pro1.0M$0.43$0.87
llmtr/mistral/voxtral-small-latest32K$0.10$0.30
llmtr/muse-glimmer-30b-tr131K$2$5
llmtr/perplexity/sonar-deep-research128K$2$8
llmtr/poolside/laguna-xs-2.1262K
llmtr/publicai/apertus-70b-instruct66K$0.82$3
llmtr/publicai/apertus-8b-instruct66K$0.10$0.20
llmtr/qwen/qwen-flash1.0M$0.05$0.40
llmtr/qwen/qwen-plus1.0M$0.40$1
llmtr/qwen/qwen3-coder-flash1.0M$0.30$2
llmtr/qwen/qwen3-coder-plus1.0M$1$5
llmtr/qwen/qwen3-max256K$1$6
llmtr/qwen/qwen3-vl-plus256K$0.20$2
llmtr/qwen/qwen3.5-397b-a17b256K$0.60$4
llmtr/qwen/qwen3.5-plus1.0M$0.40$2
llmtr/qwen/qwen3.6-flash1.0M$0.25$2
llmtr/qwen/qwen3.6-plus1.0M$0.50$3
llmtr/qwen/qwen3.7-plus1.0M$0.40$2
llmtr/qwen3-6-35b16K$5$10
llmtr/sakana/fugu-ultra1.0M$5$30
llmtr/thinkingmachines/inkling262K$2$5
llmtr/thinkingmachines/inkling-small262K$0.58$1
llmtr/trendyol-asure-12b41K$0.10$0.50
llmtr/upstage/solar-pro266K$0.15$0.60
llmtr/upstage/solar-pro3131K$0.15$0.60
llmtr/upstage/solar-pro4524K$0.03$0.12
31 available models

Advanced configuration
Direct link to Advanced configuration

Custom headers
Direct link to Custom headers

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "custom-agent",
name: "custom-agent",
model: {
url: "https://llmtr.com/v1",
id: "llmtr/gemma-4",
apiKey: process.env.LLMTR_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic model selection
Direct link to Dynamic model selection

src/mastra/agents/my-agent.ts
const agent = new Agent({
id: "dynamic-agent",
name: "Dynamic Agent",
model: ({ requestContext }) => {
const useAdvanced = requestContext.task === "complex";
return useAdvanced
? "llmtr/upstage/solar-pro4"
: "llmtr/gemma-4";
}
});
On this page