Skip to main content

Cortecs logoCortecs

Access 106 Cortecs models through Mastra's model router. Authentication is handled automatically using the CORTECS_API_KEY environment variable.

Learn more in the Cortecs documentation.

.env
CORTECS_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: "cortecs/apertus-70b"
});

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

Models
Direct link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
cortecs/apertus-70b66K$1$2
cortecs/claude-4-5-sonnet200K$3$15
cortecs/claude-4-6-sonnet1.0M$3$16
cortecs/claude-haiku-4-5200K$1.00$5
cortecs/claude-opus-51.0M$6$27
cortecs/claude-opus4-5200K$5$27
cortecs/claude-opus4-61.0M$5$27
cortecs/claude-opus4-71.0M$5$27
cortecs/claude-opus4-81.0M$5$27
cortecs/claude-sonnet-4200K$3$14
cortecs/claude-sonnet-51.0M$2$11
cortecs/codestral-2508256K$0.33$1
cortecs/deepseek-r1-0528164K$0.65$3
cortecs/deepseek-v3.2164K$0.30$0.49
cortecs/deepseek-v4-flash-07311.0M$0.09$0.17
cortecs/deepseek-v4-pro1.0M$2$3
cortecs/deepseek-v4-pro-08131.0M$2$4
cortecs/devstral-2512256K$0.48$2
cortecs/gemini-2.5-flash1.0M$0.30$2
cortecs/gemini-2.5-pro1.0M$1$10
cortecs/gemini-3.1-flash-lite1.0M$0.27$2
cortecs/gemini-3.5-flash1.0M$2$10
cortecs/gemini-3.5-flash-lite1.0M$0.33$3
cortecs/gemini-3.6-flash1.0M$0.75$4
cortecs/gemini-3.7-flash1.0M$0.75$4
cortecs/gemini-3.8-flash1.0M$0.82$4
cortecs/gemma-3-27b-it131K$0.10$0.30
cortecs/gemma-4-26b-a4b-it262K$0.11$0.56
cortecs/gemma-4-31b-it262K$0.22$0.39
cortecs/glm-4.7-flash203K$0.08$0.48
cortecs/glm-5203K$0.99$3
cortecs/glm-5-turbo203K$1$4
cortecs/glm-5.1203K$1$4
cortecs/glm-5.21.0M$1$4
cortecs/glm-5.31.0M$1$4
cortecs/glm-5.3-flash1.0M$0.10$0.35
cortecs/glm-5v-turbo203K$1$4
cortecs/gpt-4.11.0M$2$9
cortecs/gpt-4.1-mini1.0M$0.43$2
cortecs/gpt-4.1-nano1.0M$0.11$0.43
cortecs/gpt-4o128K$3$11
cortecs/gpt-4o-mini128K$0.16$0.64
cortecs/gpt-5400K$1$11
cortecs/gpt-5-mini400K$0.28$2
cortecs/gpt-5-nano400K$0.06$0.44
cortecs/gpt-5.1400K$1$11
cortecs/gpt-5.41.1M$3$15
cortecs/gpt-5.6-luna1.1M$0.22$1
cortecs/gpt-5.6-sol1.1M$6$33
cortecs/gpt-5.6-terra1.1M$2$13
cortecs/gpt-oss-120b131K$0.09$0.45
cortecs/gpt-oss-20b131K$0.04$0.17
cortecs/gpt-oss-safeguard-120b128K$0.18$0.70
cortecs/hermes-4-405b128K$1.00$3
cortecs/kimi-k2.5262K$0.49$3
cortecs/kimi-k2.6262K$0.77$3
cortecs/kimi-k2.7-code262K$0.75$4
cortecs/kimi-k31.0M$3$15
cortecs/llama-3.1-405b-instruct128K$2$2
cortecs/llama-3.1-8b-instruct128K$0.17$0.17
cortecs/llama-3.3-70b-instruct131K$0.13$0.40
cortecs/minicpm-v-4.532K$0.65$1
cortecs/minimax-m2400K$0.35$1
cortecs/minimax-m2.1196K$0.36$1
cortecs/minimax-m2.5196K$0.30$1
cortecs/minimax-m2.7197K$0.67$3
cortecs/minimax-m31.0M$0.40$2
cortecs/ministral-14b-2512256K$0.22$0.22
cortecs/ministral-3b-2512256K$0.11$0.11
cortecs/ministral-8b-2512256K$0.17$0.17
cortecs/mistral-7b-instruct-v0.232K$0.16$0.22
cortecs/mistral-7b-instruct-v0.3127K$0.11$0.11
cortecs/mistral-large-240232K$4$13
cortecs/mistral-large-2512256K$0.56$2
cortecs/mistral-medium-3.5256K$1$7
cortecs/mistral-nemo-instruct-2407128K$0.14$0.14
cortecs/mistral-small-2503128K$0.11$0.33
cortecs/mistral-small-2603262K$0.14$0.57
cortecs/mistral-small-3.2-24b-instruct-2506131K$0.10$0.31
cortecs/mixtral-8x7B-instruct-v0.132K$0.49$0.76
cortecs/nemotron-nano-v2-12b128K$0.24$0.71
cortecs/nova-2-lite1.0M$0.37$3
cortecs/nova-lite-v1300K$0.07$0.28
cortecs/nova-micro-v1128K$0.04$0.16
cortecs/nova-pro-v1300K$0.92$4
cortecs/nvidia-nemotron-3-nano-30b-a3b256K$0.06$0.24
cortecs/pixtral-12b-2409128K$0.22$0.22
cortecs/pixtral-large-2502128K$2$6
cortecs/qwen2.5-vl-72b-instruct32K$1$1
cortecs/qwen3-235b-a22b-instruct-2507262K$0.07$0.46
cortecs/qwen3-30b-a3b-instruct-2507262K$0.10$0.30
cortecs/qwen3-32b32K$0.09$0.31
cortecs/qwen3-coder-30b-a3b-instruct262K$0.07$0.24
cortecs/qwen3-coder-next256K$0.17$0.89
cortecs/qwen3-vl-235b-a22b256K$0.62$3
cortecs/qwen3.5-122b-a10b262K$0.49$3
cortecs/qwen3.5-397b-a17b262K$0.67$4
cortecs/qwen3.5-9b262K$0.11$0.17
cortecs/qwen3.6-27b262K$0.45$3
cortecs/qwen3.6-35b-a3b262K$0.17$0.56
cortecs/qwen3.8-2.4t-a95b262K$3$6
cortecs/qwen3.8-27b262K$0.10$0.40
cortecs/qwen3.8-flash-next262K$0.20$0.50
cortecs/qwen3guard-gen-0.6b32K
cortecs/qwen3guard-gen-8b32K
cortecs/voxtral-small-250732K$0.11$0.33
106 available models

Model availability, capabilities, context windows, and pricing are sourced from models.dev and may change.

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://api.cortecs.ai/v1",
id: "cortecs/apertus-70b",
apiKey: process.env.CORTECS_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
? "cortecs/voxtral-small-2507"
: "cortecs/apertus-70b";
}
});
On this page