Skip to content

Create a transcription

Turn an audio file into text, timestamps or subtitles. OpenAI compatible multipart request, with the cost in usage and a header.

Markdown
On this page
POST/v1/audio/transcriptions

Transcribes an audio file. The request is multipart/form-data as for OpenAI's transcription endpoint, so audio.transcriptions.create in the OpenAI SDKs works against it. Walkthrough: Transcription.

Form fields

filefilerequired

The audio. Lykia sets the size limit (25 MB by default). Send it last to have it streamed straight to the provider.

modelstringrequired

A transcription model id (for example openai/gpt-4o-mini-transcribe) or a preset such as @stt. List them with GET /models?kind=transcription.

languagestring

The spoken language.

promptstring

Words or context to expect, for models that take it.

response_formatstring

json (default), verbose_json, diarized_json, text, srt or vtt, as the model allows.

timestamp_granularities[]string

word and/or segment, with verbose_json.

temperaturenumber

Sampling temperature.

provider_options

, metadata, provider (string) — JSON encoded as a string.

userstring

A tag stored with the request record.

Example

Request
# Put `file` last: Lykia then streams it to the provider without storing it
curl https://api.getlykia.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $LYKIA_API_KEY" \
  -F model=openai/gpt-4o-mini-transcribe \
  -F language=en \
  -F file=@meeting.mp3
Response200
{
    "text": "hello world",
    "usage": {
        "type": "tokens",
        "input_tokens": 20,
        "output_tokens": 5,
        "total_tokens": 25,
        "input_token_details": {
            "audio_tokens": 18,
            "text_tokens": 2
        },
        "cost": 0.00005,
        "is_byok": false,
        "cost_details": {
            "upstream_cost": 0.00005,
            "platform_fee": 0,
            "is_byok": false
        }
    }
}

Response

The provider's result in OpenAI's format for the chosen response_format. With the JSON formats, usage also carries Lykia's cost (USD), is_byok and cost_details. Every format has the X-Generation-Id and X-Lykia-Cost headers. Fields that came after file and could not be applied are named in X-Lykia-Ignored-Fields.

Errors

StatusCodeWhen
400unsupported_inputAn unsupported response_format, timestamp option or audio type (metadata.param).
400unsupported_modelThe model does not transcribe audio.
403platform_sales_disabledThe provider is not offered on Lykia credits yet; add your own key for it.
413payload_too_largeThe file is larger than Lykia's limit.