XRToken API 文档

同声传译(AST)

API 配置
保存后下方「Try It」面板会自动携带此 API Key 发送真实请求。
Base: api.xrtoken.net

将音频翻译为目标语言。请求 multipart/form-data,含 file(16k/单声道/16bit wav)、model(如 doubao-ast)、modes2t 译文文字 / s2s 译文语音)、source_languagetarget_language、可选 voice(s2s 输出音色)。 mode=s2t 返回 JSON {text, source_text}mode=s2s 返回 audio/ogg 译文语音流。 计费:按 token 成本价。

POST
/v1/audio/translations

Authorization

BearerAuth
AuthorizationBearer <token>

API 密钥认证(OpenAI 格式)。在 Authorization 请求头中传入:

Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In: header

Request Body

multipart/form-data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X post "https://api.xrtoken.net/v1/audio/translations" \  -F model="doubao-ast" \  -F file="string"
{
  "text": "What was the popular song that year?",
  "source_text": "那年流行什么歌呀?"
}
{
  "error": "model field is required",
  "type": "invalid_request_error"
}
{
  "error": "invalid or missing API key",
  "type": "auth_error"
}
{
  "error": "insufficient balance -- please top up or upgrade your plan",
  "type": "billing_error"
}
{
  "error": "rate limit exceeded",
  "type": "rate_limit_error"
}
{
  "error": "upstream provider error",
  "type": "server_error"
}