curl -X POST "https://t.ato2.nodesms.com/v1/audio/transcriptions" \
-H "Authorization: Bearer $API_KEY" \
-F file="@audio.mp3" \
-F model="whisper-1"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
audio_file = open("audio.mp3", "rb")
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcript.text)
{
"text": "Hello, this is a test."
}
{
"error": {
"message": "string",
"type": "invalid_request_error",
"param": "file",
"code": "string"
}
}
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"param": null,
"code": "rate_limit_exceeded"
}
}
音频转录
将音频文件转录为文本,支持多种语言和输出格式。
POST
/
v1
/
audio
/
transcriptions
curl -X POST "https://t.ato2.nodesms.com/v1/audio/transcriptions" \
-H "Authorization: Bearer $API_KEY" \
-F file="@audio.mp3" \
-F model="whisper-1"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
audio_file = open("audio.mp3", "rb")
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcript.text)
{
"text": "Hello, this is a test."
}
{
"error": {
"message": "string",
"type": "invalid_request_error",
"param": "file",
"code": "string"
}
}
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"param": null,
"code": "rate_limit_exceeded"
}
}
请求头
string
必填
使用 Bearer Token 认证。格式:
Authorization: Bearer sk-xxxxxx请求体
格式:multipart/form-data
file
必填
要转录的音频文件。支持多种格式(如 mp3、mp4、mpeg、mpga、m4a、wav、webm)。
string
必填
模型 ID。例如
whisper-1。string
音频文件的语言,以 ISO-639-1 格式编码(如
zh、en、ja)。string
用于指导模型风格或继续先前音频片段的可选文本提示。提示应与音频语言匹配。
string
默认值:"json"
转录输出格式。可选值为
json、text、srt、verbose_json、vtt。默认值为 json。number
采样温度,介于 0 和 1 之间。默认值为 0。
array
时间戳粒度列表。可选值为
word 或 segment。仅当 response_format 设置为 verbose_json 时生效。响应
string
转录生成的文本。
curl -X POST "https://t.ato2.nodesms.com/v1/audio/transcriptions" \
-H "Authorization: Bearer $API_KEY" \
-F file="@audio.mp3" \
-F model="whisper-1"
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxx",
base_url="https://t.ato2.nodesms.com/v1"
)
audio_file = open("audio.mp3", "rb")
transcript = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(transcript.text)
{
"text": "Hello, this is a test."
}
{
"error": {
"message": "string",
"type": "invalid_request_error",
"param": "file",
"code": "string"
}
}
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"param": null,
"code": "rate_limit_exceeded"
}
}
最后修改于 2026年10月28日
此页面对您有帮助吗?