Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Cortecs logoCortecs

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

Learn more in the Cortecs documentation.

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

const agent = new Agent({
name: "my-agent",
instructions: "You are a helpful assistant",
model: "cortecs/claude-4-5-sonnet"
});

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

ModelsDirect link to Models

ModelContextToolsReasoningImageAudioVideoInput $/1MOutput $/1M
cortecs/claude-4-5-sonnet200K$3$16
cortecs/claude-sonnet-4200K$3$17
cortecs/deepseek-v3-0324128K$0.55$2
cortecs/gemini-2.5-pro1.0M$2$11
cortecs/gpt-4.11.0M$2$9
cortecs/gpt-oss-120b128K
cortecs/kimi-k2-instruct131K$0.55$3
cortecs/llama-3.1-405b-instruct128K
cortecs/nova-pro-v1300K$1$4
cortecs/qwen3-32b16K$0.10$0.33
cortecs/qwen3-coder-480b-a35b-instruct262K$0.44$2
11 available models

Advanced ConfigurationDirect link to Advanced Configuration

Custom HeadersDirect link to Custom Headers

const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.cortecs.ai/v1",
id: "cortecs/claude-4-5-sonnet",
apiKey: process.env.CORTECS_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

Dynamic Model SelectionDirect link to Dynamic Model Selection

const agent = new Agent({
name: "dynamic-agent",
model: ({ runtimeContext }) => {
const useAdvanced = runtimeContext.task === "complex";
return useAdvanced
? "cortecs/qwen3-coder-480b-a35b-instruct"
: "cortecs/claude-4-5-sonnet";
}
});

On this page