Integration guides · 2026-10-12

Alice AI LLM API: OpenAI SDK usage, pricing and streaming

Call Alice AI LLM as yandex/alice-ai-llm through an OpenAI-compatible API: 131,072-token context, pricing, a worked example, streaming and limits.

Simple diagram: an application sends a request to https://llmtr.com/v1, the box shows the model id yandex/alice-ai-llm, and the answer returns to the application.

Short answer: change base_url and the model id

LLMTR (llmtr.com) is a gateway that gives access to language models hosted in Turkey and at global providers through a single OpenAI-compatible API. You call Yandex's Alice AI LLM there with the model id yandex/alice-ai-llm on the /v1/chat/completions endpoint at https://llmtr.com/v1. In an existing OpenAI client only the base_url, the API key and the model name change; fields such as messages and max_tokens keep their names.

The LLMTR model card describes Alice AI LLM as a general-purpose model aimed at chat assistants, marketing and communication copy, and answering from external sources or a knowledge base. On LLMTR the context window is 131,072 tokens. The model takes text and returns text, and it supports tool calling, JSON output and streaming.

How to use the Alice AI LLM API with the OpenAI SDK

Create an API key on LLMTR, put it in the LLMTR_API_KEY environment variable and set the OpenAI Python client's base_url to https://llmtr.com/v1. Pass yandex/alice-ai-llm as the model. The example below sets the assistant's tone with a system message and asks for a short reply to a customer in the user message.

The answer arrives in choices[0].message.content. The usage field carries prompt_tokens, completion_tokens and total_tokens, so you can work out the cost of each request from these counts and the prices below. max_tokens limits the length of the answer, so raise it when you expect long text.

A yandex/alice-ai-llm call with the OpenAI Python SDK: a system and a user message are sent, and the answer and the token usage are printed.

import os
from openai import OpenAI

client = OpenAI(base_url="https://llmtr.com/v1", api_key=os.environ["LLMTR_API_KEY"])

response = client.chat.completions.create(
    model="yandex/alice-ai-llm",
    messages=[
        {"role": "system", "content": "You are a support assistant. Answer briefly and politely."},
        {"role": "user", "content": "Write a two-sentence reply to a customer who asks when their order will ship."},
    ],
    max_tokens=1024,
)
print(response.choices[0].message.content)
print(response.usage)

Alice AI LLM pricing and context window

LLMTR's price per 1M tokens equals the USD list price Yandex publishes. Yandex quotes its prices per 1,000 tokens; the catalog converts the same amount to a per-1M-token unit. Prices were checked on 2026-10-12. Alice AI LLM has no cache discount: all input tokens bill at the input price.

A worked example: a request with 20,000 input tokens and 1,000 output tokens costs (20,000 x $4.09836 + 1,000 x $9.836064) / 1M = $0.091803. Of that, $0.081967 comes from input and $0.009836 from output, so when you send long documents or knowledge-base passages, input drives the bill. No margin is added to this model's price; LLMTR's 8% platform fee is charged only when you top up credit.

yandex/alice-ai-llm on LLMTR (checked on 2026-10-12)
PropertyValue
Model idyandex/alice-ai-llm
Endpoint/v1/chat/completions
Context window131,072 tokens
Input and outputtext only
Input (per 1M tokens)$4.09836
Output (per 1M tokens)$9.836064
Cache discountnone
Tool calling, JSON output, streamingyes

Streaming: a curl example with stream and include_usage

To receive the answer as a stream, add "stream": true to the request. The response arrives as server-sent events (SSE) in the OpenAI-compatible streaming format. To see token usage in a stream as well, send "stream_options": {"include_usage": true}; usage arrives at the end of the stream.

In the OpenAI Python SDK the same request uses the stream=True and stream_options={"include_usage": True} parameters. If you store the usage value that arrives at the end of the stream, you can track spending per request and work out the cost with the prices above.

A yandex/alice-ai-llm streaming request with stream: true and stream_options.include_usage; token usage arrives at the end of the stream.

curl https://llmtr.com/v1/chat/completions \
  -H "Authorization: Bearer $LLMTR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "yandex/alice-ai-llm",
    "stream": true,
    "stream_options": {"include_usage": true},
    "max_tokens": 512,
    "messages": [
      {"role": "system", "content": "Answer briefly and clearly."},
      {"role": "user", "content": "Draft a short announcement for a new feature in our mobile app."}
    ]
  }'

Limits: text only, no reasoning_effort, length cut-off

Alice AI LLM accepts text only. A request that contains an image is refused with 400 unsupported_input and is not charged. reasoning_effort is not supported: a request that sends this field is refused with 400 invalid_request, so remove it from your client.

If a response comes back with finish_reason set to length, the answer was cut off: raise max_tokens and send the request again. Tool calling works with the OpenAI tools format, and JSON output works with response_format {"type": "json_object"}. According to Yandex's documentation, sending the tools field does not mean the model will actually call a tool, so your code should also handle a plain text answer. Yandex also advises saying explicitly in the prompt that you want JSON.

Getting started on LLMTR: account, key and first request

Step 1: create an account at llmtr.com and top up prepaid credit. Step 2: create a key under Dashboard > API Keys; the raw key is shown only once, so store it in an environment variable such as LLMTR_API_KEY. Step 3: in your OpenAI-compatible SDK, set base_url to https://llmtr.com/v1, use yandex/alice-ai-llm as the model and send the first request.

Each request is deducted from your credit at the catalog price in effect when it is processed; the same key works for every model in the catalog. If you want to compare Alice AI LLM with Alice AI LLM Flash from the same family on your own data, send the same request with both model ids and put the usage values side by side.

Как подключить Alice AI LLM через OpenAI SDK

LLMTR (llmtr.com) — это OpenAI-совместимый API-шлюз. Модель Alice AI LLM вызывается в нём по идентификатору yandex/alice-ai-llm через эндпоинт /v1/chat/completions по адресу https://llmtr.com/v1. В существующем коде на OpenAI SDK достаточно поменять base_url, ключ и имя модели.

Контекстное окно модели — 131 072 токена. Цена за 1 млн токенов: 4,09836 $ за входные и 9,836064 $ за выходные токены, скидки на кэшированные токены нет. Например, запрос на 20 000 входных и 1 000 выходных токенов стоит 0,091803 $. Модель принимает только текст: запрос с изображением отклоняется с ошибкой 400 и не тарифицируется. Параметр reasoning_effort не поддерживается. Поддерживаются вызов функций (tools в формате OpenAI), ответ в JSON через response_format с типом json_object и потоковая передача (stream: true); если передать stream_options.include_usage, данные usage придут в конце потока.

Как начать: зарегистрируйтесь на llmtr.com и пополните баланс; создайте ключ в разделе Dashboard > API Keys и сохраните его в переменной окружения LLMTR_API_KEY, потому что ключ показывается один раз; укажите base_url https://llmtr.com/v1, модель yandex/alice-ai-llm и отправьте первый запрос.

Практический совет: если finish_reason равен length, ответ обрезан. Увеличьте max_tokens и повторите запрос.

Call Alice AI LLM through LLMTR

Create an account, create an API key and send the first request to https://llmtr.com/v1 with yandex/alice-ai-llm.

  1. Account. Create an account at llmtr.com and top up prepaid credit.
  2. API key. Create a key under Dashboard > API Keys. The raw key is shown once; store it as the LLMTR_API_KEY environment variable.
  3. First request. In an OpenAI-compatible SDK, set base_url to https://llmtr.com/v1 and send the first request with yandex/alice-ai-llm as the model.

Frequently asked questions

How much does the Alice AI LLM API cost?

On LLMTR, per 1M tokens: $4.09836 for input and $9.836064 for output, with no cache discount. A request with 20,000 input tokens and 1,000 output tokens costs $0.091803.

Can I use Alice AI LLM with the OpenAI SDK?

Yes. Set base_url to https://llmtr.com/v1, use your LLMTR key as the API key and pass yandex/alice-ai-llm as the model. Requests go to the /v1/chat/completions endpoint.

Does Alice AI LLM accept images?

No. The model takes text and returns text. A request that contains an image is refused with 400 unsupported_input and is not charged.

Related posts