Skip to content

Transcripción de Audio (POST /v1/audio/transcriptions) ​

Transcribe audio a texto en el formato especificado con compatibilidad total a nivel de protocolo con la API de OpenAI.


Solicitud HTTP ​

http
POST /v1/audio/transcriptions
Authorization: Bearer sk-oneasr-...
Content-Type: multipart/form-data

Cuerpo de la Solicitud (Multipart Form) ​

CampoTipoRequeridoDescripción
filebinarySíEl archivo binario de audio (mp3, mp4, wav, m4a, ogg, webm, flac, etc.).
modelstringSíNombre del motor/modelo de destino (ej. faster-whisper, qwen, whisper-1).
languagestringNoCódigo de idioma ISO-639-1 (ej. es, en, zh, ja, de, ko).
promptstringNoPrompt guía opcional para orientar la ortografía o el vocabulario técnico.
response_formatstringNoFormato de salida: json (por defecto), text, srt, verbose_json, vtt.
temperaturenumberNoTemperatura de muestreo (0.0 a 1.0, por defecto: 0.0).
timestamp_granularitiesarrayNoGranularidades temporales para verbose_json: ["word"], ["segment"].

Ejemplos de Código ​

cURL ​

bash
curl -X POST http://localhost:8000/v1/audio/transcriptions   -H "Authorization: Bearer sk-oneasr-v1-xxx"   -F file="@podcast.mp3"   -F model="faster-whisper"   -F response_format="verbose_json"

Python (SDK Oficial de OpenAI) ​

python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="sk-oneasr-v1-xxx"
)

with open("speech.mp3", "rb") as f:
    result = client.audio.transcriptions.create(
        model="faster-whisper",
        file=f,
        response_format="verbose_json"
    )

print(result.text)

Respuesta (verbose_json) ​

json
{
  "task": "transcribe",
  "language": "english",
  "duration": 5.24,
  "text": "Welcome to OneASR private voice gateway.",
  "segments": [
    {
      "id": 0,
      "seek": 0,
      "start": 0.0,
      "end": 5.2,
      "text": "Welcome to OneASR private voice gateway.",
      "tokens": [50364, 4843, 284, 1530, 50589],
      "temperature": 0.0,
      "avg_logprob": -0.12,
      "compression_ratio": 1.1,
      "no_speech_prob": 0.001
    }
  ]
}