文本转语音
将文本转换为音频
POST
https://api.xiexus.cn/v1/audio/speech
请求体:必填
接口信息
方法
POST路径
/v1/audio/speech完整地址
https://api.xiexus.cn/v1/audio/speech请求体
必填
标签
音频(Audio)/原生OpenAI格式
响应码
200
静态文件
当前接口页内已嵌入 OpenAPI JSON;如果需要查看总文件,可直接打开固定静态文件
relay.json。当前 JSON
../../../openapi/generated/ai-model/音频(Audio)/原生OpenAI格式/post-v1-audio-speech-createspeech-383826485.json总文件
../../../openapi/relay.jsonOpenAPI JSON
已将服务地址固定为
https://api.xiexus.cn,其余结构保持和源文档一致。{
"openapi": "3.1.0",
"info": {
"title": "文本转语音",
"version": "1.0.0",
"description": "将文本转换为音频"
},
"tags": [
{
"name": "音频(Audio)/原生OpenAI格式"
}
],
"components": {
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"description": "使用 Bearer Token 认证。\n格式: `Authorization: Bearer sk-xxxxxx`\n"
}
}
},
"paths": {
"/v1/audio/speech": {
"post": {
"tags": [
"音频(Audio)/原生OpenAI格式"
],
"summary": "文本转语音",
"description": "将文本转换为音频",
"operationId": "createspeech",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"model",
"input",
"voice"
],
"properties": {
"model": {
"type": "string",
"examples": [
"tts-1"
]
},
"input": {
"type": "string",
"description": "要转换的文本",
"maxLength": 4096
},
"voice": {
"type": "string",
"enum": [
"alloy",
"echo",
"fable",
"onyx",
"nova",
"shimmer"
]
},
"response_format": {
"type": "string",
"enum": [
"mp3",
"opus",
"aac",
"flac",
"wav",
"pcm"
],
"default": "mp3"
},
"speed": {
"type": "number",
"minimum": 0.25,
"maximum": 4,
"default": 1
}
},
"x-apifox-orders": [
"model",
"input",
"voice",
"response_format",
"speed"
]
}
}
}
},
"security": [
{
"BearerAuth": []
}
],
"responses": {
"200": {
"description": "成功生成音频",
"content": {
"audio/mpeg": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
}
}
}
},
"servers": [
{
"url": "https://api.xiexus.cn",
"description": "固定生产地址"
}
]
}