OpenAI Transcription Speech-to-Text
Use the speech to text endpoint to receive a result in the same response.
Overview
Use the speech to text endpoint and read the result from the same response.
Quick start
- Create an API key and set it as RUNAPI_API_KEY.
- Send a POST request whose body matches the request schema.
- Read the result from the successful response body.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_API_TOKEN
Supported models
Open a model page for current pricing, rate limits, and commercial-usage details.
Request schema
Send only the fields declared for this endpoint.
gpt-transcribe9 fields
filestringAudio file upload, up to 25 MB.
keywordsarrayTerms that should receive additional recognition guidance.
languagestringAudio language as an ISO-639-1 code.
languagesarrayCandidate audio languages as ISO-639-1 codes.
modelstringTranscription model.
Allowed values:gpt-transcribe
promptstringOptional text that guides transcription style and vocabulary.
response_formatstringResponse body format.
Allowed values:json, text
streambooleanWhether to request a streamed response when supported.
temperaturenumberSampling temperature from 0 to 1.
Range:0 - 1
whisper-18 fields
filestringAudio file upload, up to 25 MB.
languagestringAudio language as an ISO-639-1 code.
modelstringTranscription model.
Allowed values:whisper-1
promptstringOptional text that guides transcription style and vocabulary.
response_formatstringResponse body format.
Allowed values:json, text, srt, verbose_json, vtt
streambooleanWhether to request a streamed response when supported.
temperaturenumberSampling temperature from 0 to 1.
Range:0 - 1
timestamp_granularitiesarrayTimestamp detail included with verbose JSON responses.
Item limit:2
Success response
POST /v1/audio/transcriptions
Response schema
{
"oneOf": [
{
"properties": {
"duration": {
"type": "number"
},
"language": {
"type": "string"
},
"logprobs": {
"items": {
"properties": {
"bytes": {
"items": {
"type": "integer"
},
"type": "array"
},
"logprob": {
"type": "number"
},
"token": {
"type": "string"
}
},
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"segments": {
"items": {
"properties": {
"avg_logprob": {
"type": "number"
},
"compression_ratio": {
"type": "number"
},
"end": {
"type": "number"
},
"id": {
"type": "integer"
},
"no_speech_prob": {
"type": "number"
},
"seek": {
"type": "integer"
},
"start": {
"type": "number"
},
"temperature": {
"type": "number"
},
"text": {
"type": "string"
},
"tokens": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
},
"task": {
"type": "string"
},
"text": {
"type": "string"
},
"usage": {
"properties": {
"input_token_details": {
"properties": {
"audio_tokens": {
"type": "integer"
},
"text_tokens": {
"type": "integer"
}
},
"type": "object",
"unevaluatedProperties": false
},
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
},
"seconds": {
"type": "number"
},
"total_tokens": {
"type": "integer"
},
"type": {
"type": "string"
}
},
"type": "object",
"unevaluatedProperties": false
},
"words": {
"items": {
"properties": {
"end": {
"type": "number"
},
"start": {
"type": "number"
},
"word": {
"type": "string"
}
},
"required": [
"word",
"start",
"end"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"text"
],
"type": "object",
"unevaluatedProperties": false
},
{
"type": "string"
}
]
}
Response example
{
"text": "Welcome to RunAPI."
}
Errors
POST /v1/audio/transcriptions
This response has no body.
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "model_must_be_one_of_gpt-transcribe_whisper-1",
"message": "model must be one of: gpt-transcribe, whisper-1"
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance"
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "api_token_credit_limit_exceeded",
"message": "API key credit limit exceeded"
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "request_conflict",
"message": "The request uses features that are not supported for the selected model"
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "rate_limited",
"message": "Rate limit reached. Please retry later."
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": {
"code": "service_unavailable",
"message": "Service under maintenance, please try again later"
}
}
Errors
POST /v1/audio/transcriptions
Response schema
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": {
"code": "timeout_error",
"message": "The request timed out"
}
}
Generated Code Samples
Use cURL directly, or install an SDK for your language. Each sample submits the validated request shown in this reference.
curl -X POST https://runapi.ai/v1/audio/transcriptions \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"file":"audio.mp3","model":"whisper-1","response_format":"json"}'
Install
npm install @runapi.ai/openai-transcription
import { OpenaiTranscriptionClient } from "@runapi.ai/openai-transcription";
const client = new OpenaiTranscriptionClient({ apiKey: process.env.RUNAPI_API_KEY });
const result = await client.speechToText.run({
"file": "audio.mp3",
"model": "whisper-1",
"response_format": "json"
});
Install
pip install runapi-openai-transcription
import os
from runapi.openai_transcription import OpenaiTranscriptionClient
client = OpenaiTranscriptionClient(api_key=os.environ["RUNAPI_API_KEY"])
result = client.speech_to_text.run(
file="audio.mp3",
model="whisper-1",
response_format="json"
)
Install
go get github.com/runapi-ai/openai-transcription-sdk/go@latest
package main
import (
"context"
"log"
"os"
"github.com/runapi-ai/core-sdk/go/option"
openaitranscription "github.com/runapi-ai/openai-transcription-sdk/go/openaitranscription"
)
func main() {
client, err := openaitranscription.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
if err != nil {
log.Fatal(err)
}
result, err := client.SpeechToText.Run(context.Background(), openaitranscription.SpeechToTextParams{
File: "audio.mp3",
Model: "whisper-1",
ResponseFormat: "json",
})
if err != nil {
log.Fatal(err)
}
_ = result
}
Install
gem install runapi-openai-transcription
require "runapi/openai_transcription"
client = RunApi::OpenaiTranscription::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
result = client.speech_to_text.run(
file: "audio.mp3",
model: "whisper-1",
response_format: "json"
)
Install
implementation("ai.runapi:runapi-openai-transcription")
import ai.runapi.openaitranscription.OpenaiTranscriptionClient;
import ai.runapi.openaitranscription.types.SpeechToTextParams;
import ai.runapi.openaitranscription.types.TranscriptionResponse;
public final class Example {
public static void main(String[] args) {
OpenaiTranscriptionClient client = OpenaiTranscriptionClient.builder()
.apiKey(System.getenv("RUNAPI_API_KEY"))
.build();
TranscriptionResponse result = client.speechToText().run(
SpeechToTextParams.builder()
.file("audio.mp3")
.model("whisper-1")
.responseFormat("json")
.build()
);
}
}
Install
composer require runapi-ai/openai-transcription
<?php
require __DIR__ . '/vendor/autoload.php';
use RunApi\Core\ClientOptions;
use RunApi\OpenaiTranscription\OpenaiTranscriptionClient;
$client = new OpenaiTranscriptionClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$result = $client->speechToText->run([
"file" => "audio.mp3",
"model" => "whisper-1",
"response_format" => "json"
]);