La API

JSON al estilo OpenAI, streaming para textos largos y errores sobre los que puedes ramificar.

Claves de API

Inicio rápido

Crea una clave arriba y envíala como token Bearer. Los caracteres se descuentan de tu saldo por solicitud y se devuelven si la solicitud falla.

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"
  }'

Solicitud

La respuesta contiene el texto traducido, el modelo usado, el consumo de tokens y el número de partes en que se dividió el texto.

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

Añade "stream": true o envía Accept: text/event-stream para recibir server-sent events: un evento chunk por parte, en orden, y luego 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}

Errores

Cada error es JSON con un código estable. Ramifica por el código y muestra el mensaje.

{
  "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

Límites

Hasta 100 000 caracteres por solicitud y 300 solicitudes por minuto por clave. Los textos largos se dividen por párrafos y se traducen en paralelo.

Idiomas

Envía códigos ISO como en, de, zh-TW o el nombre del idioma. Usa auto para detectar el idioma de origen.

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