Skip to main content
POST
/
v1
/
audio
/
transcriptions
Speech to text
curl --request POST \
  --url https://openp.ai/v1/audio/transcriptions
import requests

url = "https://openp.ai/v1/audio/transcriptions"

response = requests.post(url)

print(response.text)
const options = {method: 'POST'};

fetch('https://openp.ai/v1/audio/transcriptions', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://openp.ai/v1/audio/transcriptions",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://openp.ai/v1/audio/transcriptions"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://openp.ai/v1/audio/transcriptions")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://openp.ai/v1/audio/transcriptions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
Transcribe an audio file into text.

Request

curl https://openp.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -F [email protected] \
  -F model=whisper-1 \
  -F language=en \
  -F response_format=verbose_json

Parameters

FieldTypeRequiredDescription
filefileAudio file; supports mp3 / mp4 / mpeg / mpga / m4a / wav / webm, max 25MB
modelstringwhisper-1 / gpt-4o-transcribe / gpt-4o-mini-transcribe
languagestringISO-639-1 language code, e.g. zh / en / ja; leave empty to auto-detect
promptstringA guiding hint for domain / proper nouns / spelling
response_formatstringjson (default) / text / srt / verbose_json / vtt
temperaturenumber0-1
timestamp_granularities[]arrayword / segment; requires verbose_json

Response

response_format: "json":
{"text": "Hello, this is a test audio clip."}
response_format: "verbose_json":
{
  "task": "transcribe",
  "language": "en",
  "duration": 4.2,
  "text": "Hello, this is a test audio clip.",
  "segments": [
    {
      "id": 0,
      "start": 0.0,
      "end": 4.2,
      "text": "Hello, this is a test audio clip."
    }
  ]
}
srt / vtt return subtitle text (save directly as .srt / .vtt).

Python

from openai import OpenAI
client = OpenAI(api_key="sk-...", base_url="https://openp.ai/v1")

with open("audio.mp3", "rb") as f:
    resp = client.audio.transcriptions.create(
        model="whisper-1",
        file=f,
        response_format="verbose_json",
        timestamp_granularities=["segment"],
    )
print(resp.text)

Long-audio strategy

  • Whisper has a 25MB single-file limit; split long audio in advance (5-10 minutes per segment recommended).
  • Use prompt to pass the tail text of the previous segment to keep context coherent.
  • A tool like ffmpeg -i input.mp3 -f segment -segment_time 600 part_%03d.mp3 can split quickly.

Billing

Charged by audio duration (seconds); the specific multipliers are subject to the console.