Skip to content

OpenAI-compatible transcription

POSThttps://gptunnel.ru/v1/audio/transcriptions

This OpenAI-compatible endpoint accepts an audio file as multipart/form-data and returns the transcript in the same request. You can use the official OpenAI SDK with the GPTunneL base_url and API key.

Use multipart/form-data to upload a file. An application/json request instead creates an asynchronous task from a URL.

Request headers

ParameterTypeRequired?Description
AuthorizationstringRequiredAPI key. Support the format "Bearer YOUR_API_KEY" (as in OpenAI SDK)
Content-TypestringRequiredmultipart/form-data

Form fields

ParameterTypeRequired?Description
filefileRequiredAudio file up to 25 MB, lasting from 1 second to 2 hours
modelstringRequiredwhisper-1
languagestringOptionalLanguage code (e.g. "ru", "en"). If not specified, language is automatically defined
response_formatstringOptionaljson ( default) or verbose_json
promptstringOptionalA hint with a style or dictionary of terms
temperaturenumberOptional0 to 1

Entry file formats: flac, m4a, mp3, mp4, mpeg, mpga, oga, ogg, wav, webm.

The API detects the format from the contents of the file. A filename extension is optional. Unsupported containers such as aiff or wma return unsupported_format before contacting the provider, and the account is not charged.

Containers aiff, wma and amr available in asynchronous mode.

Download the sample WAV file and set the GPTUNNEL_API_KEY environment variable. The examples read blue-sky.wav from the current directory. For Python or Node.js, install the openai package for that language.

import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ['GPTUNNEL_API_KEY'],
base_url='https://gptunnel.ru/v1',
)
with open('blue-sky.wav', 'rb') as audio:
transcription = client.audio.transcriptions.create(
model='whisper-1',
file=audio,
language='en',
)
print(transcription.text)

The examples show excerpts from the response for the sample WAV file. With verbose_json, the API returns timestamped segments along with the full transcript.

{
"text": "The sky is blue today."
}

For whisper-1, this endpoint returns HTTP 400 for the text, srt, and vtt response formats. The example below shows the error for response_format=text.

{
"error": {
"message": "Unsupported response_format \"text\". Only \"json\" and \"verbose_json\" are supported.",
"type": "invalid_request_error",
"param": "file",
"code": "provider_rejected"
}
}

Errors return in OpenAI format:

{
"error": {
"message": "Insufficient quota. Your account balance is too low to complete this request.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_quota"
}
}
HTTP code Cause
400 missing_required_parameter Not transferred file
400 file_too_large File More Than 25 MB - Use Asynchronous Mode
400 invalid_value Unacceptable model or other parameter
400 invalid_audio File failed to decode (damaged or not audio)
400 unsupported_format Container format not supported
400 audio_too_long Longer than 2 hours
400 audio_too_short Duration less than 1 second
400 provider_rejected The conductor rejected the file or the requested response format
401 — Wrong API Key
403 model_not_allowed The model is not on the API key list
404 model_not_found Model unknown or not available key
429 insufficient_quota Insufficient balance funds
429 api_key_limit_exceeded Exceeded API-key spending limit
500 internal_error Internal error