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

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

> Сделайте первый запрос за несколько минут

## 1. Получите API-ключ

Зарегистрируйтесь на [routify.ru](https://routify.ru/auth) и создайте ключ в разделе **Настройки → API-ключи**.

Сохраните ключ — он показывается только один раз.

## 2. Первый запрос

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.routify.ru/v1/chat/completions \
    -H "Authorization: Bearer $ROUTIFY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-4.1",
      "messages": [
        {"role": "user", "content": "Привет!"}
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="ваш_ключ",
      base_url="https://api.routify.ru/v1"
  )

  response = client.chat.completions.create(
      model="gpt-4.1",
      messages=[{"role": "user", "content": "Привет!"}]
  )

  print(response.choices[0].message.content)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from "openai";

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

  const response = await client.chat.completions.create({
    model: "gpt-4.1",
    messages: [{ role: "user", content: "Привет!" }],
  });

  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

## 3. Стриминг

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="ваш_ключ",
      base_url="https://api.routify.ru/v1"
  )

  stream = client.chat.completions.create(
      model="gpt-4.1",
      messages=[{"role": "user", "content": "Расскажи анекдот"}],
      stream=True,
  )

  for chunk in stream:
      if chunk.choices[0].delta.content:
          print(chunk.choices[0].delta.content, end="", flush=True)
  ```

  ```javascript Node.js theme={null}
  const stream = await client.chat.completions.create({
    model: "gpt-4.1",
    messages: [{ role: "user", content: "Расскажи анекдот" }],
    stream: true,
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
  }
  ```
</CodeGroup>

## Следующие шаги

<CardGroup cols={2}>
  <Card title="Все модели" icon="list" href="/models">
    Выберите модель под свою задачу и бюджет
  </Card>

  <Card title="Chat Completions API" icon="message" href="/api-reference/chat-completions">
    Полная документация по параметрам запроса
  </Card>
</CardGroup>
