XRToken API 文档

文字转语音(TTS)

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

将文字转换为语音音频。计费方式:按字符数计费(含标点)。 响应为音频二进制流,Content-Typeresponse_format 变化。

请求体含 model(如 seed-tts-2.0)、input(待合成文本)、voice(音色 ID), 可选 speed(语速)、response_format(输出格式)、instructions(语音指令,不计费)。

需要火山原生参数(ssml/explicit_language/aigc_watermark 等)的场景,改用 POST /v1/audio/speech/unidirectional 原生透传端点。

POST
/v1/audio/speech

Authorization

BearerAuth
AuthorizationBearer <token>

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

Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X post "https://api.xrtoken.net/v1/audio/speech" \  -H "Content-Type: application/json" \  -d '{    "model": "seed-tts-2.0",    "input": "你好,欢迎使用 XRToken。"  }'
"string"
{
  "error": "string",
  "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"
}