同声传译(AST)
API Configuration
After saving, the Try It panel below sends real requests with this key.
Base: api.xrtoken.ai
将音频翻译为目标语言。请求 multipart/form-data,含 file(16k/单声道/16bit wav)、model(如 doubao-ast)、mode(s2t 译文文字 / s2s 译文语音)、source_language、target_language、可选 voice(s2s 输出音色)。
音频格式要求(严格校验):WAV 容器 / PCM (s16le) / 16000 Hz / 单声道 / 16 bit。不符合格式的音频将被拒绝并返回 400 错误(不会调用上游翻译服务,不产生计费)。
mode=s2t 返回 JSON {text, source_text};mode=s2s 返回 audio/ogg 译文语音流。
计费:按 token 成本价。
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"
}