Cortecs
Access 10 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-sonnet-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);
}
OpenAI Compatibility
Mastra uses the OpenAI-compatible /chat/completions endpoint. Some provider-specific features may not be available. Check the Cortecs documentation for details.
Models
| Model | Image | Audio | Video | Tools | Streaming | Context Window |
|---|---|---|---|---|---|---|
cortecs/nova-pro-v1 | ✓ | ✗ | ✗ | ✓ | ✗ | 300,000 |
cortecs/deepseek-v3-0324 | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
cortecs/kimi-k2-instruct | ✗ | ✗ | ✗ | ✓ | ✗ | 131,000 |
cortecs/gpt-4.1 | ✓ | ✗ | ✗ | ✓ | ✗ | 1,047,576 |
cortecs/gemini-2.5-pro | ✓ | ✗ | ✗ | ✓ | ✗ | 1,048,576 |
cortecs/gpt-oss-120b | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
cortecs/qwen3-coder-480b-a35b-instruct | ✗ | ✗ | ✗ | ✓ | ✗ | 262,000 |
cortecs/claude-sonnet-4 | ✓ | ✗ | ✗ | ✓ | ✗ | 200,000 |
cortecs/llama-3.1-405b-instruct | ✗ | ✗ | ✗ | ✓ | ✗ | 128,000 |
cortecs/qwen3-32b | ✗ | ✗ | ✗ | ✓ | ✗ | 16,384 |
Advanced Configuration
Custom Headers
const agent = new Agent({
name: "custom-agent",
model: {
url: "https://api.cortecs.ai/v1",
modelId: "claude-sonnet-4",
apiKey: process.env.CORTECS_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
? "cortecs/qwen3-coder-480b-a35b-instruct"
: "cortecs/claude-sonnet-4";
},
});