https://api.laozhang.ai.
Prices and token groups for these models are in the model catalog.
Before you start
Create an API key in Token management, export it in your terminal, and install the OpenAI SDK for the Python examples:Transcribe an audio file
Place the recording in the directory where you run the example; the examples usemeeting.mp3. Upload it as multipart form data with the model ID:
- cURL
- Python
text:
gpt-4o-mini-transcribe or gpt-4o-transcribe, change only the model value.
Choose a transcription model
Both GPT-4o transcribe models format punctuation and numbers cleanly. They support only
json; any other response_format returns an error.
Set the language and add a prompt
Two optional fields improve accuracy:language: the language code of the audio, such asenorzh. Without it, the model detects the language.prompt: a short text with product names, people’s names, or other terms, to help the model spell them the way you want.
Create subtitles and timestamps
Withwhisper-1, set response_format to get subtitles or segment timestamps directly:
This example saves the subtitles as
meeting.srt:
-F "file=@meeting.mp3" uploads the file’s contents; a path written as a JSON string does not. Let cURL set the multipart content type, and do not add Content-Type: application/json.
Generate speech
Send the text as JSON with a model and a voice. The response body is the audio itself, MP3 by default, so save it straight to a file:- cURL
- Python
speech.mp3 to hear the result. If the cURL request fails, speech.mp3 contains the JSON error message instead of audio; open it as text to read the error.
To use tts-1-hd or gpt-4o-mini-tts, change the model value.
tts-1 has lower latency; tts-1-hd has higher audio quality.
Control tone and output format
Two optional fields:instructions:gpt-4o-mini-ttsonly. Describe the tone, pace, or emotion of the reading.response_format: every speech model. The default ismp3;wavand the other formats are listed in OpenAI’s text-to-speech guide.
Handle errors
- 400: for transcription, check that the file was uploaded with
-F "file=@..."and that its format is supported; for speech, checkmodel,voice, andinput. - 401: check the
Authorization: Bearerheader and the API key. - 404 or model not available: check the endpoint, the exact model ID, and your token group in the model catalog.
- Timeout or 5xx: long recordings take longer to transcribe. Check call logs before uploading the same file again; a request that timed out in your client may still have completed on the server.
FAQ
Can it transcribe Chinese?
Yes. All three transcription models handle Chinese and English. Setlanguage and put names or product terms in prompt for the best results; see Set the language and add a prompt.
Can a model listen to audio and answer questions about it?
The transcription endpoint returns text only. To have a model understand audio directly, for example to summarize a meeting or judge a caller’s intent, send the audio to a Gemini model through the native API; see Send a PDF or audio file. Chat models such as GPT-6 and GPT-5.6 do not accept audio input.Why won’t my saved audio file play?
When a request fails, cURL’s-o writes the JSON error into the audio file. Open the file as text to read the error, or repeat the request without -o.
Also check that the file extension matches response_format; save WAV output as .wav, for example.