POST /v1/audio/transcriptions
Transcribe an audio file into text.
- Method: POST
- Path:
/v1/audio/transcriptions
- Auth: Bearer token in
Authorization
header - Content-Type:
multipart/form-data
Request parameters
model
(string, required): Transcription model ID (e.g.,gpt-4o-transcribe
).file
(binary, required): The audio file to transcribe.prompt
(string, optional): Optional prompt to guide the transcription.language
(string, optional): Language hint (BCP-47/ISO code if applicable).
Example requests
- Python
- Node.js
- cURL
from openai import OpenAI
client = OpenAI(base_url="https://api.naga.ac/v1", api_key="YOUR_API_KEY")
with open("audio.mp3", "rb") as f:
transcription = client.audio.transcriptions.create(
model="gpt-4o-transcribe",
file=f,
prompt=None,
language=None,
)
print(transcription.text)
import OpenAI from "openai";
import fs from "fs";
const client = new OpenAI({ baseURL: "https://api.naga.ac/v1", apiKey: "YOUR_API_KEY" });
const transcription = await client.audio.transcriptions.create({
model: "gpt-4o-transcribe",
file: fs.createReadStream("audio.mp3"),
// prompt: "Transcribe clearly and include punctuation.",
// language: "en",
});
console.log(transcription.text);
curl https://api.naga.ac/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F file="@audio.mp3" \
-F model="gpt-4o-transcribe"
Response
Returns a JSON object with the transcription result, e.g.:
{ "text": "Hello and welcome to NagaAI!" }