The API

OpenAI-style JSON, streaming for long texts and errors you can branch on.

API keys

Quick start

Create a key above and send it as a Bearer token. Characters are deducted from your balance per request and refunded if the request fails.

curl https://api.translay.app/v1/translate \
  -H "Authorization: Bearer tr_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Where meaning travels intact.",
    "source_language": "auto",
    "target_language": "ru",
    "mode": "quality"
  }'

Request

The response contains the translated text, the model used, token usage and the number of parts the text was split into.

fieldtypenotes
textstringrequired, up to 100,000 characters
target_languagestringrequired, ISO code or language name
source_languagestringoptional, default auto
modefast | qualityoptional, default fast
streambooleanoptional, server-sent events
{
  "translation": {
    "text": "Там, где смысл доходит без потерь.",
    "model": "glm5.3-flash",
    "prompt_tokens": 61,
    "completion_tokens": 14,
    "chunks": 1
  },
  "remaining_chars": 4999971
}

Streaming

Add "stream": true, or send Accept: text/event-stream, to receive server-sent events: one chunk event per part in order, then done.

event: chunk
data: {"index":0,"total":3,"text":"Первая часть…"}

event: chunk
data: {"index":1,"total":3,"text":"Вторая часть…"}

event: done
data: {"translation":{"model":"qwen3.7-flash","chunks":3,"prompt_tokens":2410,"completion_tokens":2388},"remaining_chars":4988120}

Errors

Every error is JSON with a stable code. Branch on the code, show the message.

{
  "error": "Not enough characters on the balance",
  "code": "INSUFFICIENT_BALANCE",
  "details": { "required": 1834, "balance": 120 }
}
codestatus
INVALID_API_KEY401
INVALID_REQUEST400
INVALID_TRANSLATION400
INSUFFICIENT_BALANCE402
RATE_LIMITED429
TRANSLATION_FAILED503

Limits

Up to 100,000 characters per request and 300 requests per minute per key. Long texts are split at paragraph boundaries and translated in parallel.

Languages

Pass ISO codes such as en, de, zh-TW, or any language name. Use auto to detect the source language.

GET https://api.translay.app/v1/languages
Authorization: Bearer tr_live_…