> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sunra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Быстрый старт LLM

Sunra предоставляет три эндпоинта LLM API, каждый из которых следует своему формату. Все три используют одну и ту же аутентификацию и базовый URL (`https://api-llm.sunra.ai`), поэтому вы можете выбрать тот формат, который лучше подходит для вашего стека.

Прежде чем начать, получите API-ключ в вашей [панели управления](https://sunra.ai/dashboard/api-tokens).

## Chat Completions — `/v1/chat/completions`

Эндпоинт [Chat Completions](/ru/llm/chat) следует формату **OpenAI Chat Completions**. Он принимает список сообщений с ролями (`system`, `user`, `assistant`) и возвращает completion.

Используйте этот эндпоинт, когда вам нужна полная совместимость с SDK и инструментами OpenAI.

**Ключевые возможности:** streaming, function calling, vision (изображения, аудио, видео, файлы), reasoning, structured outputs (JSON schema / grammar), logprobs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/chat/completions \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "What is the capital of France?" }
    ]
  }'
```

## Anthropic Messages — `/v1/messages`

Эндпоинт [Anthropic Messages](/ru/llm/messages) следует формату **Anthropic Messages API**. Он использует роли сообщений `user` / `assistant` с расширенными блоками контента и отдельным параметром `system`.

Используйте этот эндпоинт, когда вам нужен нативный доступ к моделям Anthropic Claude и таким функциям, как extended thinking, prompt caching, citations и встроенные инструменты (web search, code execution).

**Ключевые возможности:** streaming, extended thinking, prompt caching, tool use (custom + built-in), ввод PDF/документов, citations, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/messages \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Responses — `/v1/responses`

Эндпоинт [Responses](/ru/llm/responses) следует формату **OpenAI Responses API**. Он принимает гибкие input items (сообщения, function calls, reasoning) и возвращает structured output items.

Используйте этот эндпоинт, когда вам нужны новейшие возможности OpenAI Responses, такие как встроенный web search, file search, code interpreter, computer use, интеграция MCP tools или image generation.

**Ключевые возможности:** streaming, function calling, web search, file search, code interpreter, computer use, MCP tools, image generation, reasoning, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/responses \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "input": [
      { "type": "message", "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Выбор подходящего эндпоинта

|                       | Chat Completions           | Anthropic Messages         | Responses                                                    |
| --------------------- | -------------------------- | -------------------------- | ------------------------------------------------------------ |
| **Формат**            | OpenAI Chat                | Anthropic Messages         | OpenAI Responses                                             |
| **Лучше всего для**   | Совместимость с SDK OpenAI | Нативные функции Claude    | Новейшие функции OpenAI                                      |
| **Streaming**         | SSE                        | SSE                        | SSE                                                          |
| **Function calling**  | Да                         | Да (custom + built-in)     | Да                                                           |
| **Reasoning**         | Да                         | Extended thinking          | Да                                                           |
| **Structured output** | JSON schema, grammar       | JSON schema                | JSON schema                                                  |
| **Built-in tools**    | —                          | Web search, code execution | Web search, file search, code interpreter, computer use, MCP |

Все три эндпоинта используют одну и ту же аутентификацию — просто передайте ваш API-ключ как Bearer-токен в заголовке `Authorization`.
