Create Transcription
Audio transcription endpoint. Supports multipart file, file_id, url, and audio_url; audio_data is not supported.
Authentication
Add Authorization: Bearer <API_KEY> to the request headers to authenticate. You can generate a key on the console "API Keys" page.
curl https://api.mosi.cn/v1/audio/transcriptions \
-H "Authorization: Bearer $MOSS_API_KEY"
Supported models
| Field | Allowed values |
|---|---|
| model |
|
Choose transcription mode
| Scenario | model | version | stream | Response format |
|---|---|---|---|---|
| Standard audio transcription | moss-transcribe | None, or moss-transcribe-v1 | None | JSON / text |
| Multi-speaker, non-streaming | moss-transcribe-diarize | moss-transcribe-diarize-20260325 | None | JSON with segments |
| Multi-speaker, streaming | moss-transcribe-diarize | v20260410-streamparam-20260703 | true | SSE |
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | See "Choose transcription mode" for values. |
| version | string | Conditionally required | Recommended to pass explicitly for multi-speaker transcription; see "Choose transcription mode" for values. |
| file | multipart file | Conditionally required | Required when uploading via multipart; one of |
| file_id | string | Conditionally required | Required when using an uploaded file; one of |
| url | string | Conditionally required | Required when using a public audio URL; one of |
| audio_url | string | Conditionally required | Compatibility field for |
| diarize | boolean | No | Whether to return speaker-separation results; recommended to pass |
| stream | boolean | No | Pass |
| response_format | string | No |
|
| async | boolean | No | Creates an asynchronous task when set to |
| webhook_url | string | No | The HTTPS URL to call back once the asynchronous task completes. |
Request example
{
"model": "moss-transcribe",
"file_id": "<file_id>",
"response_format": "json"
}
Response fields
Standard transcription (response_format=json)
| Field | Type | Always returned | Description |
|---|---|---|---|
| text | string | Yes | The full recognized text. |
Multi-speaker, non-streaming
| Field | Type | Always returned | Description |
|---|---|---|---|
| task | string | Yes | Task type, currently returns |
| duration | number | Yes | Audio duration, in seconds. |
| text | string | Yes | The full transcription text. |
| segments | array | Yes | Segment list; may be an empty array for short audio or when there are no valid segments. |
| segments[].type | string | When segmented | Segment event type. |
| segments[].id | string | When segmented | Segment ID. |
| segments[].start | number | When segmented | Segment start time, in seconds. |
| segments[].end | number | When segmented | Segment end time, in seconds. |
| segments[].text | string | When segmented | Text of the segment. |
| segments[].speaker | string | When segmented | Speaker label, for example |
Text response (response_format=text)
Multi-speaker, streaming SSE
When stream=true, text/event-stream is returned; SSE frames consist only of data: lines (no event: line), and the event type is carried in the type field of each frame's JSON.
| Field | Type | Always returned | Description |
|---|---|---|---|
| task.created | SSE event | Yes | Streaming task creation event, carrying |
| transcript.text.delta | SSE event | As applicable | Incremental text event, carrying a |
| transcript.segment.done | SSE event | As applicable | Segment completion event, carrying |
| transcript.text.done | SSE event | Yes | Transcription completion event, may carry the full |
| usage | object | Optional in events | Usage information, returned according to the actual server events. |
data: {"type":"task.created","task_id":"<task_id>","object":"audio.transcription","status":"PROCESSING","model":"moss-transcribe-diarize"}
data: {"type":"transcript.text.delta","delta":"大家"}
data: {"type":"transcript.segment.done","content_index":0,"speaker":"S01","text":"大家好,"}
data: {"type":"transcript.segment.done","content_index":1,"speaker":"S02","text":"你好。"}
data: {"type":"transcript.text.done","text":"大家好,你好。","usage":{"prompt_tokens":142,"completion_tokens":12,"total_tokens":154}}
Asynchronous creation response (async=true)
| Field | Type | Always returned | Description |
|---|---|---|---|
| id | string | Yes | Task ID. |
| task_id | string | Yes | Task query ID, usually the same as |
| object | string | Yes | Always |
| status | string | Yes | Initial status, for example |
| retry_after | integer | No | Suggested polling interval, in seconds. |
| created_at | integer | Yes | Creation time, a Unix timestamp in seconds. |
| updated_at | integer | No | Update time, a Unix timestamp in seconds. |
For the result fields after an asynchronous task completes, see GET /v1/audio/tasks/{task_id}.