Audio Transcriptions
An OpenAI-compatible speech-to-text endpoint; upload audio via multipart and pay by duration.
Request
- Authentication: request header
Authorization: Bearer sk-tp-...(create an API Key in the Console) - Content-Type:
multipart/form-data
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | Audio file, 25MB max; returns 413 if exceeded |
| model | string | Yes | Platform transcription model name; see Model list |
| Other parameters | - | No | language, prompt, temperature, and others are passed through per the OpenAI protocol |
The platform always requests the upstream with response_format=verbose_json (duration billing depends on it, so any value the caller passes for this parameter is overridden). The response additionally includes duration (audio length in seconds).
Response
Returns transcription JSON (text is the transcript; duration is the audio length in seconds). The response headers carry billing information for this call:
| Header | Description |
|---|---|
| X-Cost-Yuan | Cost of this call (yuan, 6 decimal places) |
| X-Bill-Units | Billed seconds for this call |
Billing
- Transcription models are priced in "yuan per minute" and converted to seconds based on the actual audio duration: cost = unit price × seconds ÷ 60.
- If the upstream response lacks
duration, the platform rejects the request (returns400, no charge), consistent with "no usage, no settlement".
Pre-checks
Before the call, the platform validates in order; if any step fails, an error is returned:
- Key valid and not revoked (including all parents), account status normal → otherwise
401 fileuploaded, model exists and is available (LIVE), is duration-billed with a unit price configured → otherwise400- File no larger than 25MB → otherwise
413 - Account balance greater than 0, key chain quota not exhausted → otherwise
402 - Upstream returned the audio duration → otherwise
400(no charge)
Errors
For the error response body format and troubleshooting, see FAQ · Error codes. Errors returned by the upstream model service are passed through verbatim (status code and response body unchanged).