# ![Cortecs logo](https://models.dev/logos/cortecs.svg)Cortecs

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

Learn more in the [Cortecs documentation](https://cortecs.ai).

```bash
CORTECS_API_KEY=your-api-key
```

```typescript
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 uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Cortecs documentation](https://cortecs.ai) for details.

## Models

| Model                                    | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
| ---------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
| `cortecs/claude-4-5-sonnet`              | 200K    |       |           |       |       |       | $3         | $16         |
| `cortecs/claude-4-6-sonnet`              | 1.0M    |       |           |       |       |       | $4         | $18         |
| `cortecs/claude-haiku-4-5`               | 200K    |       |           |       |       |       | $1         | $5          |
| `cortecs/claude-opus4-5`                 | 200K    |       |           |       |       |       | $6         | $30         |
| `cortecs/claude-opus4-6`                 | 1.0M    |       |           |       |       |       | $6         | $30         |
| `cortecs/claude-sonnet-4`                | 200K    |       |           |       |       |       | $3         | $17         |
| `cortecs/deepseek-v3-0324`               | 128K    |       |           |       |       |       | $0.55      | $2          |
| `cortecs/devstral-2512`                  | 262K    |       |           |       |       |       | —          | —           |
| `cortecs/devstral-small-2512`            | 262K    |       |           |       |       |       | —          | —           |
| `cortecs/gemini-2.5-pro`                 | 1.0M    |       |           |       |       |       | $2         | $11         |
| `cortecs/glm-4.5`                        | 131K    |       |           |       |       |       | $0.67      | $2          |
| `cortecs/glm-4.5-air`                    | 131K    |       |           |       |       |       | $0.22      | $1          |
| `cortecs/glm-4.7`                        | 198K    |       |           |       |       |       | $0.45      | $2          |
| `cortecs/glm-4.7-flash`                  | 203K    |       |           |       |       |       | $0.09      | $0.53       |
| `cortecs/glm-5`                          | 203K    |       |           |       |       |       | $1         | $3          |
| `cortecs/gpt-4.1`                        | 1.0M    |       |           |       |       |       | $2         | $9          |
| `cortecs/gpt-oss-120b`                   | 128K    |       |           |       |       |       | —          | —           |
| `cortecs/intellect-3`                    | 128K    |       |           |       |       |       | $0.22      | $1          |
| `cortecs/kimi-k2-instruct`               | 131K    |       |           |       |       |       | $0.55      | $3          |
| `cortecs/kimi-k2-thinking`               | 262K    |       |           |       |       |       | $0.66      | $3          |
| `cortecs/kimi-k2.5`                      | 256K    |       |           |       |       |       | $0.55      | $3          |
| `cortecs/llama-3.1-405b-instruct`        | 128K    |       |           |       |       |       | —          | —           |
| `cortecs/minimax-m2`                     | 400K    |       |           |       |       |       | $0.39      | $2          |
| `cortecs/minimax-m2.1`                   | 196K    |       |           |       |       |       | $0.34      | $1          |
| `cortecs/minimax-m2.5`                   | 197K    |       |           |       |       |       | $0.32      | $1          |
| `cortecs/nova-pro-v1`                    | 300K    |       |           |       |       |       | $1         | $4          |
| `cortecs/qwen3-32b`                      | 16K     |       |           |       |       |       | $0.10      | $0.33       |
| `cortecs/qwen3-coder-480b-a35b-instruct` | 262K    |       |           |       |       |       | $0.44      | $2          |
| `cortecs/qwen3-next-80b-a3b-thinking`    | 128K    |       |           |       |       |       | $0.16      | $1          |

## Advanced configuration

### Custom headers

```typescript
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"
    }
  }
});
```

### Dynamic model selection

```typescript
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";
  }
});
```