Create a transcription task
Create a transcription task
Section titled “Create a transcription task”POST
https://gptunnel.ru/v1/audio/transcriptionsTranscription runs asynchronously. The endpoint creates a task and returns its id and status. Set callback_url to receive the result via webhook, or poll the result endpoint.
Request headers
| Parameter | Type | Required? | Description |
|---|---|---|---|
Authorization | string | Required | API key |
Request body
| Parameter | Type | Required? | Description |
|---|---|---|---|
audio_url | string | Required | Direct public HTTP or HTTPS URL for the audio or video file |
model | string | Required | Model: deepgram-whisper-tiny | deepgram-whisper-medium | deepgram-whisper-large |
language | string | Optional | Language code (e.g. "ru", "en"). If not specified, language is automatically defined |
callback_url | string | Optional | URL to send the result (webhook). Must be public |
Example request
Section titled “Example request”Set your API key in the GPTUNNEL_API_KEY environment variable. The Python example uses requests and the cURL example uses jq. Save the task ID printed by the example and pass it as task_id when you retrieve the transcription. All three examples use the sample WAV file from the quickstart. To transcribe a different file, set GPTUNNEL_AUDIO_URL to its public HTTPS URL.
import os
import requests
response = requests.post( 'https://gptunnel.ru/v1/audio/transcriptions', headers={'Authorization': os.environ['GPTUNNEL_API_KEY']}, json={ 'audio_url': os.environ.get('GPTUNNEL_AUDIO_URL') or 'https://docs.gptunnel.ru/examples/blue-sky.wav', 'model': 'deepgram-whisper-tiny', 'language': 'en', }, timeout=30,)response.raise_for_status()print(response.json()['id'])audio_url=${GPTUNNEL_AUDIO_URL:-https://docs.gptunnel.ru/examples/blue-sky.wav}body=$(jq -nc --arg url "$audio_url" '{audio_url: $url, model: "deepgram-whisper-tiny", language: "en"}')curl --fail-with-body --silent --show-error \ --url 'https://gptunnel.ru/v1/audio/transcriptions' \ --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \ --json "$body" \ | jq -er '.id'const response = await fetch('https://gptunnel.ru/v1/audio/transcriptions', { method: 'POST', headers: { Authorization: process.env.GPTUNNEL_API_KEY, 'Content-Type': 'application/json', }, body: JSON.stringify({ audio_url: process.env.GPTUNNEL_AUDIO_URL || 'https://docs.gptunnel.ru/examples/blue-sky.wav', model: 'deepgram-whisper-tiny', language: 'en', }),})
if (!response.ok) throw new Error(await response.text())console.log((await response.json()).id)Example response
Section titled “Example response”{ "code": 0, "id": "6a47bb78fb3f0d852e64c8e3", "status": "processing"}{ "code": 3, "message": "Invalid input, check schema issues."}{ "code": 8, "message": "Audio is too long. Maximum duration is 2 hours."}{ "code": 9, "message": "Audio is too short. Minimum duration is 1 second."}{ "code": 12, "message": "Could not read the audio file at audio_url. Ensure the link is a direct, publicly accessible file URL (no bot protection), supports HTTP Range requests, and returns a correct Content-Length."}{ "code": 19, "message": "Model is not allowed for this API key. Adjust allowed models in the dashboard or use another key."}{ "code": 4, "message": "Record not found."}{ "code": 11, "message": "Unsupported audio format. Supported formats: mp3, mp2, wav, flac, aac, ogg, oga, opus, m4a, mp4, mov, 3gp, alac, webm, mka, wma, wmv, amr, aiff, ac3, avi, flv, ts, mpg, au."}{ "code": 5, "message": "Insufficient balance, check account balance."}{ "code": 10, "message": "Could not read audio duration in time. Ensure audio_url is a direct, fast, publicly reachable link."}Errors that arise after the creation of a task are listed in transcription errors.