OpenAI Speech Recognition API (/v1/audio/transcriptions)
Transcribe audio to text, fully compatible with OpenAI's /v1/audio/transcriptions. Any OpenAI SDK can directly use it by pointing the base_url to https://api.acedata.cloud and replacing the key with your AceData Token. The interface synchronously returns the transcription result.
- Request URL:
POST https://api.acedata.cloud/v1/audio/transcriptions(aliasPOST /openai/audio/transcriptions) - Authentication: Request header
Authorization: Bearer {token} - Request Format:
multipart/form-data - Billing: Charged based on audio duration (see table below), rounded up to the nearest second.
¶ Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
file |
file | Yes | The audio file to be transcribed, maximum 25 MB. Supports flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm. |
model |
string | No | Transcription model, currently supports whisper-1 (default). |
language |
string | No | Audio language, ISO-639-1 code (e.g., zh, en). Specifying can improve accuracy and speed; leave blank for automatic detection. |
prompt |
string | No | Prompt words to guide writing style or provide proper nouns and terms to improve recognition accuracy. |
response_format |
string | No | json (default), text, srt, verbose_json, vtt. |
temperature |
number | No | Sampling temperature 0–1, default 0. |
timestamp_granularities[] |
array | No | Timestamp granularity, word or segment, must be used with response_format=verbose_json. |
¶ Example
curl -X POST 'https://api.acedata.cloud/v1/audio/transcriptions' \
-H 'authorization: Bearer {token}' \
-F file=@audio.mp3 \
-F model=whisper-1
Response:
{
"text": "Ace Data Cloud Platform is testing the speech recognition endpoint. The quick brown fox jumps over the lazy dog."
}
Chinese audio is also supported without specifying the language:
{
"text": "欢迎使用 AceData Cloud 平台,我们正在测试语音识别接口,今天是 7 月 31 号。"
}
¶ Generate Subtitles
Set response_format to srt or vtt to directly obtain a usable subtitle file:
curl -X POST 'https://api.acedata.cloud/v1/audio/transcriptions' \
-H 'authorization: Bearer {token}' \
-F file=@audio.mp3 \
-F model=whisper-1 \
-F response_format=srt \
-o subtitle.srt
Returned content (Content-Type: text/plain):
1
00:00:00,000 --> 00:00:03,800
Ace Data Cloud Platform is testing the speech recognition endpoint.
2
00:00:03,800 --> 00:00:06,280
The quick brown fox jumps over the lazy dog.
¶ Word-Level Timestamps
To get the start and end times for each word, use verbose_json with timestamp_granularities[]=word:
curl -X POST 'https://api.acedata.cloud/v1/audio/transcriptions' \
-H 'authorization: Bearer {token}' \
-F file=@audio.mp3 \
-F model=whisper-1 \
-F response_format=verbose_json \
-F 'timestamp_granularities[]=word'
Response:
{
"task": "transcribe",
"language": "english",
"duration": 6.29,
"text": "Ace Data Cloud Platform is testing the speech recognition endpoint. The quick brown fox jumps over the lazy dog.",
"words": [
{ "word": "Ace", "start": 0.0, "end": 0.32 },
{ "word": "Data", "start": 0.32, "end": 0.54 },
{ "word": "Cloud", "start": 0.54, "end": 0.86 }
]
}
¶ Using the Official SDK
from openai import OpenAI
client = OpenAI(base_url="https://api.acedata.cloud/v1", api_key="{token}")
with open("audio.mp3", "rb") as f:
result = client.audio.transcriptions.create(model="whisper-1", file=f)
print(result.text)
¶ Pricing
| Model | Platform Price |
|---|---|
whisper-1 |
$0.0078 / minute |
Charged based on actual audio duration, rounded up to the nearest second, with a maximum of 1 hour per single request.
¶ Notes
- The maximum size for a single file is 25 MB. If exceeded, please segment or compress (usually lowering the bitrate suffices, as speech recognition does not require high audio quality).
- This interface does not support streaming responses (the
streamparameter will be ignored). - Requests can be time-consuming, so it is recommended to set the client timeout to no less than 300 seconds.
¶ Error Codes
| Status Code | Code | Description |
|---|---|---|
| 400 | bad_request |
file not provided, file cannot be parsed, or invalid parameters. |
| 401 | authentication_failed |
Invalid token. |
| 403 | used_up |
Insufficient balance. |
| 413 | request_too_large |
Audio file exceeds 25 MB limit. |
| 429 | too_many_requests |
Too many requests, please try again later. |
| 500 | api_error |
Upstream/internal error. |
