Документация
Подключение к Tierlify
Один ключ, два формата API и 65 моделей. Всё, что нужно, чтобы отправить первый запрос и выйти в продакшен.
Введение
Tierlify — API-релей: один ключ и один эндпоинт для 65 моделей восьми провайдеров. Он понимает два формата — OpenAI и Anthropic, поэтому подключается к существующим SDK без переписывания кода. Цены за токены совпадают с прайсом провайдеров.
| Формат | Base URL | Эндпоинты |
|---|---|---|
| OpenAI | https://api.tierlify.eu.cc/v1 | /chat/completions, /responses, /models |
| Anthropic | https://api.tierlify.eu.cc | /v1/messages, /v1/messages/count_tokens |
Любая модель доступна в любом формате: Claude можно вызывать через OpenAI SDK, а GPT — через Anthropic SDK. Tierlify сам переводит запросы и ответы.
Tierlify is an API relay: one key and one endpoint for 65 models from eight providers. It speaks two formats — OpenAI and Anthropic — so it plugs into the SDKs you already use without rewriting code. Token prices match each provider's list price.
| Format | Base URL | Endpoints |
|---|---|---|
| OpenAI | https://api.tierlify.eu.cc/v1 | /chat/completions, /responses, /models |
| Anthropic | https://api.tierlify.eu.cc | /v1/messages, /v1/messages/count_tokens |
Every model works in either format: call Claude through the OpenAI SDK or GPT through the Anthropic SDK. Tierlify translates requests and responses for you.
Быстрый старт
-
Получите ключ
Зарегистрируйтесь и создайте ключ в консоли. Ключ начинается с
tl-sk-и показывается один раз — сохраните его.Sign up and create a key in the console. Keys start with
tl-sk-and are shown once — save it somewhere safe. -
Сохраните ключ в окружении
-
Установите SDK
Подойдёт официальный SDK OpenAI или Anthropic — свой ставить не нужно.
Use the official OpenAI or Anthropic SDK — there is nothing of ours to install.
-
Отправьте первый запрос
Чтобы сменить модель, поменяйте поле
model— например, наgpt-5.6-terraилиgemini-4-carbon. Все ID есть в каталоге.To switch models, change the
modelfield — for example togpt-5.6-terraorgemini-4-carbon. Every ID is in the catalog.
Аутентификация
Передавайте ключ в заголовке запроса. Оба эндпоинта принимают оба варианта:
Authorization: Bearer tl-sk-…— как в OpenAI;x-api-key: tl-sk-…— как в Anthropic.
Не встраивайте ключ во фронтенд и мобильные приложения — его легко извлечь. Вызывайте API со своего сервера.
Send the key in a request header. Both endpoints accept either style:
Authorization: Bearer tl-sk-…— the OpenAI way;x-api-key: tl-sk-…— the Anthropic way.
Never ship the key in a frontend or mobile app — it is easy to extract. Call the API from your own server.
OpenAI-формат
Совместим с OpenAI API. Укажите в SDK base URL https://api.tierlify.eu.cc/v1 — остальной код не меняется.
| Метод | Путь | Описание |
|---|---|---|
| POST | /v1/chat/completions | Диалог в формате Chat Completions |
| POST | /v1/responses | Responses API |
| GET | /v1/models | Список доступных моделей |
| GET | /v1/key | Лимит, расход и баланс ключа |
Поддерживаются messages, temperature, max_tokens, stream, tools, tool_choice, response_format и reasoning_effort. Параметры, которые модель не поддерживает, игнорируются.
Compatible with the OpenAI API. Set the SDK base URL to https://api.tierlify.eu.cc/v1 and keep the rest of your code.
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions | Chat Completions conversations |
| POST | /v1/responses | Responses API |
| GET | /v1/models | List available models |
| GET | /v1/key | The key's limit, spend and balance |
Supported: messages, temperature, max_tokens, stream, tools, tool_choice, response_format and reasoning_effort. Parameters a model does not support are ignored.
Anthropic-формат
Совместим с Anthropic Messages API. В SDK укажите base URL https://api.tierlify.eu.cc — путь /v1/messages SDK добавит сам. Без SDK передавайте заголовок anthropic-version: 2023-06-01.
| Метод | Путь | Описание |
|---|---|---|
| POST | /v1/messages | Сообщения |
| POST | /v1/messages/count_tokens | Подсчёт токенов до отправки |
Compatible with the Anthropic Messages API. Set the SDK base URL to https://api.tierlify.eu.cc — the SDK adds /v1/messages itself. Without an SDK, send the anthropic-version: 2023-06-01 header.
| Method | Path | Description |
|---|---|---|
| POST | /v1/messages | Messages |
| POST | /v1/messages/count_tokens | Count tokens before sending |
Список моделей
GET /v1/models возвращает модели с размером контекста и ценами за 1M токенов. Полный каталог с описаниями — на странице моделей.
GET /v1/models returns every model with its context window and prices per 1M tokens. The full catalog with descriptions is on the models page.
Стриминг
Передайте stream: true — ответ придёт событиями Server-Sent Events по мере генерации. Формат событий совпадает с выбранным API, поэтому стриминг в SDK работает без изменений.
Pass stream: true and the answer arrives as Server-Sent Events while it is generated. Events follow the format you call, so SDK streaming works unchanged.
Инструменты
Function calling работает в обоих форматах. Модель возвращает вызов инструмента с аргументами, ваш код выполняет его и отправляет результат следующим сообщением.
Function calling works in both formats. The model returns a tool call with arguments; your code runs it and sends the result back in the next message.
Изображения
Модели с отметкой «Изображения» в каталоге принимают картинки по URL или в base64 вместе с текстом.
Models marked “Image input” in the catalog accept pictures by URL or as base64 alongside text.
Ошибки
Ошибки приходят с HTTP-статусом и JSON-телом. В request_id — идентификатор запроса: укажите его, если пишете в поддержку.
| Код | Тип | Что делать |
|---|---|---|
| 400 | invalid_request | Проверьте параметры запроса |
| 401 | invalid_api_key | Ключ отсутствует, отозван или с опечаткой |
| 402 | insufficient_credits | Пополните баланс или поднимите месячный лимит ключа |
| 403 | permission_denied | Аккаунт заблокирован — напишите в поддержку |
| 404 | model_not_found | Сверьте ID модели с GET /v1/models |
| 413 | context_length_exceeded | Сократите промпт или возьмите модель с бóльшим контекстом |
| 429 | rate_limit_exceeded | Подождите время из заголовка retry-after |
| 502 | upstream_error | Провайдер вернул ошибку — повторите или смените модель |
| 503 | overloaded | Провайдер перегружен — повторите с нарастающей паузой |
Errors come with an HTTP status and a JSON body. request_id identifies the request — include it when you contact support.
| Code | Type | What to do |
|---|---|---|
| 400 | invalid_request | Check the request parameters |
| 401 | invalid_api_key | The key is missing, revoked or mistyped |
| 402 | insufficient_credits | Top up, or raise the key's monthly limit |
| 403 | permission_denied | The account is blocked — contact support |
| 404 | model_not_found | Check the model ID against GET /v1/models |
| 413 | context_length_exceeded | Shorten the prompt or pick a model with a larger window |
| 429 | rate_limit_exceeded | Wait for the time in the retry-after header |
| 502 | upstream_error | The provider failed — retry or switch models |
| 503 | overloaded | The provider is overloaded — retry with backoff |
Лимиты и уровни
Лимиты считаются на аккаунт и зависят от уровня. Уровень определяется суммой оплаченных пополнений за всё время и повышается сразу после оплаты; приветственный бонус в сумму не входит. Остаток запросов приходит в заголовках каждого ответа: x-ratelimit-limit-requests, x-ratelimit-remaining-requests и x-ratelimit-reset-requests.
| Уровень | Пополнено всего | Запросов в минуту | API-ключей | История запросов |
|---|---|---|---|---|
| Free | — | 10 | 2 | 7 дней |
| Уровень 1 | от $5 | 60 | 10 | 30 дней |
| Уровень 2 | от $50 | 300 | 25 | 90 дней |
| Уровень 3 | от $250 | 1 000 | без лимита | 180 дней |
| Уровень 4 | от $1 000 | 3 000 | без лимита | 365 дней |
Нужно больше — напишите на support@tierlify.eu.cc, поднимем лимиты вручную. Провайдеры могут ограничивать отдельные модели сильнее: тогда придёт 429 с заголовком retry-after.
Сколько осталось, показывает GET /v1/key с тем же ключом: месячный лимит ключа (limit), расход по нему с начала месяца (usage), остаток (limit_remaining), баланс аккаунта (balance) и лимит запросов в минуту (rate_limit). У ключа без лимита limit и limit_remaining равны null, а тратить он может весь баланс. Формат ответа совместим с /api/v1/key у OpenRouter.
Limits are counted per account and depend on your tier. The tier follows the total of your paid top-ups over time and goes up right after a payment; the welcome bonus doesn't count. Every response carries the headers x-ratelimit-limit-requests, x-ratelimit-remaining-requests and x-ratelimit-reset-requests.
| Tier | Topped up in total | Requests per minute | API keys | Request history |
|---|---|---|---|---|
| Free | — | 10 | 2 | 7 days |
| Tier 1 | from $5 | 60 | 10 | 30 days |
| Tier 2 | from $50 | 300 | 25 | 90 days |
| Tier 3 | from $250 | 1,000 | unlimited | 180 days |
| Tier 4 | from $1,000 | 3,000 | unlimited | 365 days |
Need more? Write to support@tierlify.eu.cc and we'll raise your limits by hand. Providers may cap individual models more tightly: you'll then get a 429 with a retry-after header.
To see what's left, call GET /v1/key with the same key: it returns the key's monthly limit (limit), its spend since the start of the month (usage), what remains (limit_remaining), the account balance (balance) and the requests-per-minute limit (rate_limit). For a key without a limit, limit and limit_remaining are null and it can spend the whole balance. The response follows OpenRouter's /api/v1/key.
Баланс и списания
Подписок нет: вы пополняете баланс в долларах, и каждый запрос списывается с него. Стоимость запроса — это входящие токены × цена входа, плюс токены из кэша × цена кэша, плюс исходящие токены × цена выхода. Цены совпадают с прайсом провайдеров и указаны в каталоге.
Комиссия берётся только при пополнении: 5% сервиса плюс комиссия способа оплаты. Подробности и калькулятор — на странице цен. Баланс не сгорает; когда он заканчивается, API отвечает 402 insufficient_credits.
Стоимость каждого ответа приходит в поле usage.cost (в долларах) и в заголовке x-tierlify-cost.
There are no subscriptions: you top up a balance in US dollars and every request is charged to it. A request costs its input tokens × the input price, plus cached tokens × the cache price, plus output tokens × the output price. Prices match the providers' list prices and are in the catalog.
The only fee comes with a top-up: 5% for the service plus the payment method's fee. Details and a calculator are on the pricing page. The balance never expires; once it runs out, the API answers 402 insufficient_credits.
Each response reports its cost in usage.cost (in dollars) and in the x-tierlify-cost header.
Ключи и безопасность
- Заводите отдельный ключ на каждое приложение и окружение — так один можно отозвать, не трогая остальные.
- Задайте месячный лимит расходов на ключ: запросы сверх лимита получат
402. - При утечке отзовите ключ в консоли — он перестанет работать сразу.
- Не храните ключи
tl-sk-в коде и публичных репозиториях — держите их в переменных окружения или менеджере секретов.
- Create a separate key per app and environment so one can be revoked without touching the others.
- Set a monthly spend limit per key: requests over it get a
402. - If a key leaks, revoke it in the console — it stops working immediately.
- Keep
tl-sk-keys out of code and public repositories — use environment variables or a secrets manager.
Cursor
Откройте Settings → Models → API Keys. Вставьте ключ Tierlify в поле OpenAI API Key, включите Override OpenAI Base URL и укажите https://api.tierlify.eu.cc/v1. Затем добавьте модели по ID, например claude-opus-5-5 или gpt-5.6-sol.
Собственные API-ключи доступны не на всех тарифах Cursor.
Open Settings → Models → API Keys. Paste your Tierlify key into OpenAI API Key, turn on Override OpenAI Base URL and enter https://api.tierlify.eu.cc/v1. Then add models by ID, for example claude-opus-5-5 or gpt-5.6-sol.
Your own API keys are not available on every Cursor plan.
Claude Code
Claude Code работает через Anthropic-формат. Задайте переменные окружения и запустите его как обычно.
Claude Code talks the Anthropic format. Set these environment variables and start it as usual.
Codex CLI
Добавьте Tierlify как провайдера в ~/.codex/config.toml.
Add Tierlify as a provider in ~/.codex/config.toml.
AI SDK и LangChain
Фреймворки с поддержкой OpenAI-совместимых провайдеров подключаются так же: base URL и ключ.
Frameworks that support OpenAI-compatible providers connect the same way: a base URL and a key.