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

Access 49 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-opus4-7`                 | 1.0M    |       |           |       |       |       | $6         | $28         |
| `cortecs/claude-sonnet-4`                | 200K    |       |           |       |       |       | $3         | $17         |
| `cortecs/codestral-2508`                 | 256K    |       |           |       |       |       | $0.30      | $0.90       |
| `cortecs/deepseek-r1-0528`               | 164K    |       |           |       |       |       | $0.58      | $2          |
| `cortecs/deepseek-v3-0324`               | 128K    |       |           |       |       |       | $0.55      | $2          |
| `cortecs/deepseek-v3.2`                  | 164K    |       |           |       |       |       | $0.27      | $0.44       |
| `cortecs/deepseek-v4-flash`              | 1.0M    |       |           |       |       |       | $0.13      | $0.27       |
| `cortecs/deepseek-v4-pro`                | 1.0M    |       |           |       |       |       | $2         | $3          |
| `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/glm-5.1`                        | 205K    |       |           |       |       |       | $1         | $4          |
| `cortecs/gpt-4.1`                        | 1.0M    |       |           |       |       |       | $2         | $9          |
| `cortecs/gpt-oss-120b`                   | 128K    |       |           |       |       |       | —          | —           |
| `cortecs/hermes-4-70b`                   | 128K    |       |           |       |       |       | $0.12      | $0.36       |
| `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/kimi-k2.6`                      | 256K    |       |           |       |       |       | $0.81      | $4          |
| `cortecs/llama-3.1-405b-instruct`        | 128K    |       |           |       |       |       | —          | —           |
| `cortecs/llama-3.3-70b-instruct`         | 131K    |       |           |       |       |       | $0.09      | $0.28       |
| `cortecs/minimax-m2`                     | 400K    |       |           |       |       |       | $0.39      | $2          |
| `cortecs/minimax-m2.1`                   | 196K    |       |           |       |       |       | $0.34      | $1          |
| `cortecs/minimax-m2.5`                   | 197K    |       |           |       |       |       | $0.32      | $1          |
| `cortecs/minimax-m2.7`                   | 203K    |       |           |       |       |       | $0.47      | $1          |
| `cortecs/mistral-large-2512`             | 256K    |       |           |       |       |       | $0.50      | $2          |
| `cortecs/mixtral-8x7B-instruct-v0.1`     | 32K     |       |           |       |       |       | $0.44      | $0.68       |
| `cortecs/nemotron-3-super-120b-a12b`     | 262K    |       |           |       |       |       | $0.27      | $0.80       |
| `cortecs/nova-pro-v1`                    | 300K    |       |           |       |       |       | $1         | $4          |
| `cortecs/qwen-2.5-72b-instruct`          | 33K     |       |           |       |       |       | $0.06      | $0.23       |
| `cortecs/qwen3-235b-a22b-instruct-2507`  | 131K    |       |           |       |       |       | $0.06      | $0.41       |
| `cortecs/qwen3-32b`                      | 16K     |       |           |       |       |       | $0.10      | $0.33       |
| `cortecs/qwen3-coder-30b-a3b-instruct`   | 262K    |       |           |       |       |       | $0.05      | $0.22       |
| `cortecs/qwen3-coder-480b-a35b-instruct` | 262K    |       |           |       |       |       | $0.44      | $2          |
| `cortecs/qwen3-coder-next`               | 256K    |       |           |       |       |       | $0.16      | $0.84       |
| `cortecs/qwen3-next-80b-a3b-thinking`    | 128K    |       |           |       |       |       | $0.16      | $1          |
| `cortecs/qwen3.5-122b-a10b`              | 262K    |       |           |       |       |       | $0.44      | $3          |
| `cortecs/qwen3.5-397b-a17b`              | 250K    |       |           |       |       |       | $0.60      | $4          |

## 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.5-397b-a17b"
      : "cortecs/claude-4-5-sonnet";
  }
});
```