Документация

Подключение к Tierlify

Один ключ, два формата API и 65 моделей. Всё, что нужно, чтобы отправить первый запрос и выйти в продакшен.

Введение

Tierlify — API-релей: один ключ и один эндпоинт для 65 моделей восьми провайдеров. Он понимает два формата — OpenAI и Anthropic, поэтому подключается к существующим SDK без переписывания кода. Цены за токены совпадают с прайсом провайдеров.

ФорматBase URLЭндпоинты
OpenAIhttps://api.tierlify.eu.cc/v1/chat/completions, /responses, /models
Anthropichttps://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.

FormatBase URLEndpoints
OpenAIhttps://api.tierlify.eu.cc/v1/chat/completions, /responses, /models
Anthropichttps://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.

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

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

    Зарегистрируйтесь и создайте ключ в консоли. Ключ начинается с tl-sk- и показывается один раз — сохраните его.

    Sign up and create a key in the console. Keys start with tl-sk- and are shown once — save it somewhere safe.

  2. Сохраните ключ в окружении

  3. Установите SDK

    Подойдёт официальный SDK OpenAI или Anthropic — свой ставить не нужно.

    Use the official OpenAI or Anthropic SDK — there is nothing of ours to install.

  4. Отправьте первый запрос

    Чтобы сменить модель, поменяйте поле model — например, на gpt-5.6-terra или gemini-4-carbon. Все ID есть в каталоге.

    To switch models, change the model field — for example to gpt-5.6-terra or gemini-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/responsesResponses 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.

MethodPathDescription
POST/v1/chat/completionsChat Completions conversations
POST/v1/responsesResponses API
GET/v1/modelsList available models
GET/v1/keyThe 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.

MethodPathDescription
POST/v1/messagesMessages
POST/v1/messages/count_tokensCount 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 — идентификатор запроса: укажите его, если пишете в поддержку.

КодТипЧто делать
400invalid_requestПроверьте параметры запроса
401invalid_api_keyКлюч отсутствует, отозван или с опечаткой
402insufficient_creditsПополните баланс или поднимите месячный лимит ключа
403permission_deniedАккаунт заблокирован — напишите в поддержку
404model_not_foundСверьте ID модели с GET /v1/models
413context_length_exceededСократите промпт или возьмите модель с бóльшим контекстом
429rate_limit_exceededПодождите время из заголовка retry-after
502upstream_errorПровайдер вернул ошибку — повторите или смените модель
503overloadedПровайдер перегружен — повторите с нарастающей паузой

Errors come with an HTTP status and a JSON body. request_id identifies the request — include it when you contact support.

CodeTypeWhat to do
400invalid_requestCheck the request parameters
401invalid_api_keyThe key is missing, revoked or mistyped
402insufficient_creditsTop up, or raise the key's monthly limit
403permission_deniedThe account is blocked — contact support
404model_not_foundCheck the model ID against GET /v1/models
413context_length_exceededShorten the prompt or pick a model with a larger window
429rate_limit_exceededWait for the time in the retry-after header
502upstream_errorThe provider failed — retry or switch models
503overloadedThe provider is overloaded — retry with backoff

Лимиты и уровни

Лимиты считаются на аккаунт и зависят от уровня. Уровень определяется суммой оплаченных пополнений за всё время и повышается сразу после оплаты; приветственный бонус в сумму не входит. Остаток запросов приходит в заголовках каждого ответа: x-ratelimit-limit-requests, x-ratelimit-remaining-requests и x-ratelimit-reset-requests.

УровеньПополнено всегоЗапросов в минутуAPI-ключейИстория запросов
Free—1027 дней
Уровень 1от $5601030 дней
Уровень 2от $503002590 дней
Уровень 3от $2501 000без лимита180 дней
Уровень 4от $1 0003 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.

TierTopped up in totalRequests per minuteAPI keysRequest history
Free—1027 days
Tier 1from $5601030 days
Tier 2from $503002590 days
Tier 3from $2501,000unlimited180 days
Tier 4from $1,0003,000unlimited365 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.