Skip to main content

Cortecs logo皮层

🌐 Cortecs logoCortecs

通过 Mastra 的模型路由访问 16 个 Cortecs 模型。身份验证会自动使用 CORTECS_API_KEY 环境变量处理。

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

Cortecs 文档 中了解更多信息。

🌐 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/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 使用与 OpenAI 兼容的 /chat/completions 端点。一些特定于提供商的功能可能不可用。详情请查看 Cortecs 文档

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

模型
Direct 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/devstral-2512262K
cortecs/devstral-small-2512262K
cortecs/gemini-2.5-pro1.0M$2$11
cortecs/gpt-4.11.0M$2$9
cortecs/gpt-oss-120b128K
cortecs/intellect-3128K$0.22$1
cortecs/kimi-k2-instruct131K$0.55$3
cortecs/kimi-k2-thinking262K$0.66$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
cortecs/qwen3-next-80b-a3b-thinking128K$0.16$1
16 available models

高级配置
Direct link to 高级配置

🌐 Advanced Configuration

自定义头
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/claude-4-5-sonnet",
apiKey: process.env.CORTECS_API_KEY,
headers: {
"X-Custom-Header": "value"
}
}
});

动态模型选择
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/qwen3-next-80b-a3b-thinking"
: "cortecs/claude-4-5-sonnet";
}
});