# Chat and Assistants APIs

Source: [Chat and Assistants APIs](<https://docs.gptunnel.ru/en/api/>)

<a id="_top"></a>
Use these APIs to call text models, list available models and prices, or chat with an assistant that uses your knowledge base.

Chat Completions works with the OpenAI-compatible SDK. Configure the GPTunneL base URL and your API key. For streams, see [streaming responses](<https://docs.gptunnel.ru/en/api/chat-completions/streaming/>). Claude models also support the [Anthropic Messages format](<https://docs.gptunnel.ru/en/api/anthropic-messages/>) for the Anthropic SDK and Claude Code.

<a id="base-url"></a>
## Base URL

```plaintext
https://gptunnel.ru/v1
```

Send your [API key](<https://docs.gptunnel.ru/en/#get-an-api-key>) in the `Authorization` header.

<a id="endpoints"></a>
## Endpoints

| Method | Endpoint | Behavior |
| --- | --- | --- |
| `GET` | [`/v1/models`](<https://docs.gptunnel.ru/en/api/models/>) | List available models with their prices |
| `POST` | [`/v1/chat/completions`](<https://docs.gptunnel.ru/en/api/chat-completions/>) | Get a chat response as JSON or stream it with SSE |
| `POST` | [`/v1/obfuscate`](<https://docs.gptunnel.ru/en/api/obfuscate/>) | Replace personal data in text without calling a model |
| `POST` | [`/v1/assistant/chat`](<https://docs.gptunnel.ru/en/api/assistants/chat/>) | Send a message to an assistant that uses its knowledge base |
| `POST` | [`/v1/messages`](<https://docs.gptunnel.ru/en/api/anthropic-messages/>) | Call Claude models in the Anthropic Messages format |

See the [Assistants API overview](<https://docs.gptunnel.ru/en/api/assistants/about/>) for how assistants differ from regular chat. Create the knowledge bases they use with the [RAG API](<https://docs.gptunnel.ru/en/rag/>).

<a id="call-formats"></a>
## Call Formats

| Format | Method and availability |
| --- | --- |
| Chat Completions | [`POST /v1/chat/completions`](<https://docs.gptunnel.ru/en/api/chat-completions/>). JSON and SSE verified with `gpt-6-luna`. |
| Anthropic Messages | [`POST /v1/messages`](<https://docs.gptunnel.ru/en/api/anthropic-messages/>). JSON and event streaming verified with `claude-5.5-haiku`. |
| Responses | `POST /v1/responses` for models with Responses enabled. |
| Gemini | `POST /v1/models/{model}:generateContent` and `POST /v1beta/models/{model}:generateContent` for models with Gemini enabled. For streaming, use `:streamGenerateContent?alt=sse` with the matching API version. |

A model listed in the [catalog](<https://docs.gptunnel.ru/en/api/models/>) is visible to your API key. Availability through Responses or Gemini depends on the model’s enabled formats. For example, `grom-1.5-pro` worked with Chat Completions but returned `404` and `Model is not enabled for this API format.` in tests with Responses and Gemini. If you receive this error, use Chat Completions or select a model that supports the format you need.

For regular Chat Completions, send the previous messages in `messages`. When [chatting with an assistant](<https://docs.gptunnel.ru/en/api/assistants/chat/>), reuse your `chatId` and pass a positive `maxContext` to include previous messages.

<a id="whats-important-to-know"></a>
## What’s important to know

The models endpoint also returns rates. See [request pricing](<https://docs.gptunnel.ru/en/getting-started/pricing/>).

After a model is retired, requests run on the designated replacement and are billed at the rate of the model you originally requested. If there is no replacement, Chat Completions returns HTTP `410`. See [deprecated models](<https://docs.gptunnel.ru/en/getting-started/deprecated-models/>).
