# Coding agents

A coding agent that lets you change its model provider works with the Model API: give it our address and a Model API key. Each page below sets one agent up by hand, by editing its own settings. Every setup names the model `auto`, which picks a model of the [catalogue](/models) for the conversation (see [Model choice auto](/docs/model-api-routing#model-choice-auto)).

| Agent | Protocol | Where the setup lives |
| --- | --- | --- |
| [Claude Code](/docs/claude-code) | Anthropic Messages, `POST /v1/messages` | `env` in `~/.claude/settings.json` or the shell |
| [Codex](/docs/codex) | OpenAI Responses, `POST /v1/responses` | `~/.codex/config.toml` |
| [OpenCode](/docs/opencode) | OpenAI Chat Completions, `POST /v1/chat/completions` | `~/.config/opencode/opencode.json` |
| [Cursor](/docs/cursor) | OpenAI Chat Completions, `POST /v1/chat/completions` | Cursor Settings, Models |

Any other agent that speaks one of these protocols takes the same address: `https://api.samreshuuu.ru/v1` for the OpenAI protocols, `https://api.samreshuuu.ru` without a path for Anthropic Messages.

## Before you start

1. Top up the [organization balance](https://console.samreshuuu.ru): every call of the agent is paid from it at the price of the host that answered.
2. In the console, open API keys, keep **Model API key** in the **Access** field and create the key. The secret is shown once.

Check that the key works before you change an agent:

**cURL**

```bash
curl https://api.samreshuuu.ru/v1/chat/completions \
  -H "Authorization: Bearer $SAMRESHUUU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"Hi! What can you do?"}]}'
```

**Python**

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["SAMRESHUUU_API_KEY"], base_url="https://api.samreshuuu.ru/v1")

reply = client.chat.completions.create(
    model="deepseek/deepseek-v4.1-flash",
    messages=[{"role": "user", "content": "Hi! What can you do?"}],
)
print(reply.choices[0].message.content)
print(reply.usage)
```

**Node.js**

```typescript
import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.SAMRESHUUU_API_KEY, baseURL: "https://api.samreshuuu.ru/v1" });

const reply = await client.chat.completions.create({
    model: "deepseek/deepseek-v4.1-flash",
    messages: [{ role: "user", content: "Hi! What can you do?" }],
});
console.log(reply.choices[0].message.content);
console.log(reply.usage);
```

**Anthropic SDK**

```python
import os
from anthropic import Anthropic

client = Anthropic(api_key=os.environ["SAMRESHUUU_API_KEY"], base_url="https://api.samreshuuu.ru")

reply = client.messages.create(
    model="deepseek/deepseek-v4.1-flash",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hi! What can you do?"}],
)
print(reply.content[0].text)
```

## What each agent gets

- Tools: the agent's own tools (files, shell, search in the project) travel as tool calls of its protocol. The agent runs them; the model calls them.
- Reasoning: the level the agent asks for reaches the model, brought to the nearest level its host takes (see [reasoning](/docs/model-api-requests#reasoning)).
- Cache: each agent names its session, and its calls stay in one [cache](/docs/model-api-routing#prompt-caching).
- Cost: every call shows up in the call log of the [console](https://console.samreshuuu.ru) with its model, host and cost. The agents count a price of their own and do not show what the balance was charged.
