Speech to text
curl --request POST \
--url https://openp.ai/v1/audio/transcriptionsimport 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_bodyOpenAI-compatible
Speech to text
POST /v1/audio/transcriptions — Whisper / GPT-4o transcribe
POST
/
v1
/
audio
/
transcriptions
Speech to text
curl --request POST \
--url https://openp.ai/v1/audio/transcriptionsimport 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_bodyTranscribe 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
| Field | Type | Required | Description |
|---|---|---|---|
file | file | ✅ | Audio file; supports mp3 / mp4 / mpeg / mpga / m4a / wav / webm, max 25MB |
model | string | ✅ | whisper-1 / gpt-4o-transcribe / gpt-4o-mini-transcribe |
language | string | ISO-639-1 language code, e.g. zh / en / ja; leave empty to auto-detect | |
prompt | string | A guiding hint for domain / proper nouns / spelling | |
response_format | string | json (default) / text / srt / verbose_json / vtt | |
temperature | number | 0-1 | |
timestamp_granularities[] | array | word / 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
promptto 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.mp3can split quickly.