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.
| field | type | notes |
|---|---|---|
text | string | required, up to 100,000 characters |
target_language | string | required, ISO code or language name |
source_language | string | optional, default auto |
mode | fast | quality | optional, default fast |
stream | boolean | optional, 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 }
}| code | status |
|---|---|
INVALID_API_KEY | 401 |
INVALID_REQUEST | 400 |
INVALID_TRANSLATION | 400 |
INSUFFICIENT_BALANCE | 402 |
RATE_LIMITED | 429 |
TRANSLATION_FAILED | 503 |
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_…