Skip to main content
LaoZhang API accepts the OpenAI Audio API format for two tasks: transcribing a recording and turning text into speech. Send both requests to 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 use meeting.mp3. Upload it as multipart form data with the model ID:
The response is JSON with the transcript in text:
To use gpt-4o-transcribe, change only the model value.

Choose a transcription model

Both models format punctuation and numbers cleanly. They support only json and text for response_format; any other value returns an error.

Set the language and add a prompt

Two optional fields improve accuracy:
  • language: the language code of the audio, such as en or zh. 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

whisper-1 is no longer available, and the current transcription models cannot return subtitles or timestamps directly. For gpt-4o-mini-transcribe and gpt-4o-transcribe, response_format accepts:
  • Works: json, text
  • Returns an error: srt, vtt, verbose_json
If you were calling whisper-1, migrate like this:
  • Change model to gpt-4o-mini-transcribe.
  • Remove response_format, or set it to json or text.
-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:
Play 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-tts only. Describe the tone, pace, or emotion of the reading.
  • response_format: every speech model. The default is mp3; wav and the other formats are listed in OpenAI’s text-to-speech guide.
Accepted audio formats, maximum file sizes, and available voices depend on the model; check OpenAI’s speech-to-text guide and text-to-speech guide before you send large files or choose a voice.

Handle errors

  • 400: for transcription, check that the file was uploaded with -F "file=@..." and that its format is supported; for speech, check model, voice, and input.
  • 401: check the Authorization: Bearer header 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. Both transcription models handle Chinese and English. Set language and put names or product terms in prompt for the best results; see Set the language and add a prompt.

Can I still use whisper-1?

No. whisper-1 has been withdrawn. A request for it returns 503 with a message that the model has no available channel. To migrate:
  • Change model to gpt-4o-mini-transcribe; the endpoint and request format stay the same.
  • If you used response_format to get SRT, VTT, or verbose_json, remove it or set it to json or text.

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.