语音生文本接口文档
版本历史
版本号 | 日期 | 修改内容 |
---|---|---|
v1.0 | 2024-08-29 | 初版 |
MaaS Whisper
公共信息
参数 | 描述 | 示例 |
---|---|---|
basePath | 调用mass api的基础路径,包含/v1/ai固定路径 | https://genaiapi.cloudsway.net/v1/ai |
endpointPath | 调用mass api的生成的一段随机路径 | RkBOAlaWzKcubSji |
AccessKey | 调用mass api的accessKey | RWxxxxxxxx0Gd |
按照上面示例,最终请求模型接口的路径为https://genaiapi.cloudsway.net/v1/ai/RkBOAlaWzKcubSji
请求方法
POST
请求路径
{basePath}/{endpointPath}/audio/transcriptions
请求header
参数 | 描述 | 示例 |
---|---|---|
Authorization | AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
请求body
字段名 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
file | File | 是 | 音频文件 | mp3、mp4、mpweg、mpga、m4a、wav、webm ,文件大小限制为25M |
prompt | String | 否 | 提示词 | "Generate a video of a sunset over the ocean." |
response_format | String | 否 | 指定模型返回结果的格式 | json,verbose_json |
temperature | String | 否 | 温度 | 0-1之间的值 |
language | String | 否 | 指定音频文件的语言 | "en"(英语),"zh"(中文),"es"(西班牙语)等 |
timestamp_granularities | String | 否 | 指定时间戳的粒度 | "none":不生成时间戳 "word":为每个词生成时间戳 "sentence":为每个句子生成时间戳。 |
返回值
字段名 | 类型 | 描述 | 示例值 |
---|---|---|---|
text | String | 音频转录文本 |
示例
请求
curl --request POST \
--url https://genaiapipre.cloudsway.net/v1/ai/RkBOAlaWzKcubSji/audio/transcriptions \
--header 'Accept: */*' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'Connection: keep-alive' \
--header 'Content-Type: multipart/form-data' \
--header 'Host: genaiapipre.cloudsway.net' \
--header 'content-type: multipart/form-data' \
--form 'prompt=A poetic description of early morning, including words like dawn, quiet, mist, and possibility' \
--form response_format=verbose_json \
--form temperature=0.1 \
--form language=en \
--form timestamp_granularities=none \
--form 'file=xx.wav'
返回值
{
"text": "In this ancient town, plum blossoms bloom silently. The white petals are like snow, falling on the branches, welcoming the cold winter. The fragrance of the flowers is elegant, and it touches the heart, as if it is the scent of time. In this ancient town, plum blossoms bloom silently. Every plum blossom is a small miracle, which blooms in the coldness of life. They are not afraid of the cold, they are firm, symbolizing hope and rebirth. The blooming of plum blossoms is like the praise of nature for life, warming everyone's heart. Each blossom is a small miracle, symbolizing hope and rebirth. Standing under the plum trees, it is as if you can hear the rain of years. Flowers bloom and fall, spring and autumn come. Plum blossoms witness the turning of time, and witness people's joy and sorrow. They are the guardians of memory, quietly preserving the story of this town. Standing under the plum tree, one can almost hear the whispers of time. Plum blossoms are not just a plant, but also a spiritual symbol. It teaches us to keep hope in adversity, to find warmth in the cold winter. Every year's blooming is a praise of life, a hope for the future. Plum blossoms teach us to keep hope alive in adversity. Let's cherish the beauty before us and embrace every moment of life bravely. Let's cherish the beauty before us and embrace every moment of life bravely."
}
音频翻译英文
请求方法
POST
请求路径
{basePath}/{endpointPath}/audio/translation
请求header
参数 | 描述 | 示例 |
---|---|---|
Authorization | AccessKey Bearer ${AccessKey} |
Bearer RWxxxxxxxx0Gd |
请求body
字段名 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
file | File | 是 | 音频文件 | mp3、mp4、mpweg、mpga、m4a、wav、webm ,文件大小限制为25M |
prompt | String | 否 | 提示词 | "Generate a video of a sunset over the ocean." |
response_format | String | 否 | 指定模型返回结果的格式 | json,verbose_json |
temperature | String | 否 | 温度 | 0-1之间的值 |
返回值
字段名 | 类型 | 描述 | 示例值 |
---|---|---|---|
text | String | 音频翻译英文 |
示例
请求
curl --location --request POST 'https://genaiapipre.cloudsway.net/v1/ai/RkBOAlaWzKcubSji/audio/translation' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'Accept: */*' \
--header 'Host: genaiapipre.cloudsway.net' \
--header 'Connection: keep-alive' \
--header 'Content-Type: multipart/form-data; boundary=--------------------------726232426471513578566370' \
--form 'prompt=A poetic description of early morning, including words like dawn, quiet, mist, and possibility' \
--form 'response_format=verbose_json' \
--form 'temperature=0.1' \
--form 'timestamp_granularities=none' \
--form 'file=xxx.wav"'
返回值
{
"text": "In this ancient town, plum blossoms bloom silently. The white petals are like snow, falling on the branches, welcoming the cold winter. The fragrance of the flowers is elegant, and it touches the heart, as if it is the scent of time. In this ancient town, plum blossoms bloom silently. Every plum blossom is a small miracle, which blooms in the coldness of life. They are not afraid of the cold, they are firm, symbolizing hope and rebirth. The blooming of plum blossoms is like the praise of nature for life, warming everyone's heart. Each blossom is a small miracle, symbolizing hope and rebirth. Standing under the plum trees, it is as if you can hear the rain of years. Flowers bloom and fall, spring and autumn come. Plum blossoms witness the turning of time, and witness people's joy and sorrow. They are the guardians of memory, quietly preserving the story of this town. Standing under the plum tree, one can almost hear the whispers of time. Plum blossoms are not just a plant, but also a spiritual symbol. It teaches us to keep hope in adversity, to find warmth in the cold winter. Every year's blooming is a praise of life, a hope for the future. Plum blossoms teach us to keep hope alive in adversity. Let's cherish the beauty before us and embrace every moment of life bravely. Let's cherish the beauty before us and embrace every moment of life bravely."
}