Audio transcription

Introduction

Discover authorized source IDs using GET /v1/audio/transcription-models.

BASH
curl 'https://api.anycap.io/v1/audio/transcription-models' -H 'Authorization: Bearer YOUR_ANYCAP_KEY'

Upload a private recording and retrieve a transcript, detected language, duration and segment timestamps. Capability key: audio.asr. Duration-priced sources use the measured uploaded recording length, rounded up to seconds, and charge only after successful transcription. Read the quote for the credit amount.

1. Upload a recording

WAV and MP3 are supported, up to 15 MiB and 10 minutes. Use the returned id as audio_file_id. Uploads and transcript results are retained for 72 hours.

BASH
curl 'https://api.anycap.io/v1/transcription-materials?kind=audio' -H 'Authorization: Bearer YOUR_ANYCAP_KEY' -F '[email protected]'

2. Quote and submit

Select an authorized resource_id from the capability source list. Quote and submit with the same recording and language. Submission returns HTTP 202 and a job object.

BASH
curl 'https://api.anycap.io/api/v1/capabilities/audio.asr/quotes' -H 'Authorization: Bearer YOUR_ANYCAP_KEY' -H 'Content-Type: application/json' -d '{"resource_id":"SOURCE_UUID","audio_file_id":"FILE_UUID","language":"zh"}'
BASH
curl 'https://api.anycap.io/api/v1/capabilities/audio.asr/executions' -H 'Authorization: Bearer YOUR_ANYCAP_KEY' -H 'Content-Type: application/json' -d '{"resource_id":"SOURCE_UUID","audio_file_id":"FILE_UUID","language":"zh","quote_id":"QUOTE_UUID","idempotency_key":"YOUR_OPERATION_UUID"}'
ParameterDescription
audio_file_id
ID of an owned audio upload
language
Optional: zh for Chinese, en for English; omitted or auto detects the language
resource_id
Authorized audio transcription source ID
quote_id
Quote ID required for submission
idempotency_key
Stable identifier for the submission operation

3. Retrieve the transcript

BASH
curl 'https://api.anycap.io/api/v1/transcription-executions/JOB_UUID' -H 'Authorization: Bearer YOUR_ANYCAP_KEY'

States are queued, submitting, completed, failed and pending. Read result.text when completed; result.segments[] contains start, end (seconds) and text. Expired results are omitted; job history remains readable.

JSON
{  "state": "completed",  "result": {    "text": "你好,欢迎使用音频转文字。",    "language": "zh",    "duration": 3.2,    "segments": [      {        "id": 0,        "start": 0,        "end": 3.2,        "text": "你好,欢迎使用音频转文字。"      }    ]  }}
HTTPMeaning
400Invalid audio, language or request
401 / 403Check key, organization access and source permissions
409Quote or repeated request parameters conflict
429Queue or request rate limit reached