Package-level declarations

Types

Link copied to clipboard
@Serializable
data class AudioInputTokenDetails(val audioTokens: Int? = null, val textTokens: Int? = null)

Input token breakdown for audio requests.

Link copied to clipboard
@Serializable
data class AudioLogprob(val token: String? = null, val bytes: List<Int>? = null, val logprob: Double? = null)

Token confidence information returned by transcription models.

Link copied to clipboard
@Serializable
value class AudioResponseFormat(val value: String)
Link copied to clipboard
data class AudioTranscription(val text: String, val language: String? = null, val duration: Double? = null, val segments: List<Segment>? = null, val words: List<Word>? = null, val logprobs: List<AudioLogprob>? = null, val languages: List<TranscriptionLanguage>? = null, val usage: AudioUsage? = null, val diarizedSegments: List<DiarizedSegment>? = null, val task: String? = null)

Modern transcription result with model-specific confidence, usage and speaker details.

Link copied to clipboard
@Serializable
data class AudioUsage(val type: String? = null, val inputTokens: Int? = null, val outputTokens: Int? = null, val totalTokens: Int? = null, val seconds: Double? = null, val inputTokenDetails: AudioInputTokenDetails? = null)

Usage for token-based or duration-based audio billing.

Link copied to clipboard
@Serializable
data class CustomVoice(val id: String)

Custom voice created from an audio sample.

Link copied to clipboard
@Serializable
data class DiarizedSegment(val id: String, val speaker: String, val start: Double, val end: Double, val text: String, val type: String = "transcript.text.segment")

Speaker-labeled transcript segment.

Link copied to clipboard
@Serializable
data class Segment(val id: Int, val seek: Int, val start: Double, val end: Double, val text: String, val tokens: List<Int>, val temperature: Double, val avgLogprob: Double, val compressionRatio: Double, val noSpeechProb: Double, val transient: Boolean? = null)
Link copied to clipboard
@Serializable
data class SpeechEvent(val type: String, val delta: String? = null, val audio: String? = null, val usage: AudioUsage? = null)

Incremental speech event containing base64 audio or completion usage.

Link copied to clipboard
@Serializable
data class SpeechOptions(val instructions: String? = null, val streamFormat: SpeechStreamFormat? = null, val customVoice: CustomVoice? = null)

Additional controls for modern speech models.

Link copied to clipboard
@Serializable
data class SpeechRequest(val model: ModelId, val input: String, val voice: Voice? = null, val responseFormat: SpeechResponseFormat? = null, val speed: Double? = null)

Generates audio from the input text.

Link copied to clipboard

A speech request builder.

Link copied to clipboard
@Serializable
value class SpeechResponseFormat(val value: String)
Link copied to clipboard

Response framing for speech delivery.

Link copied to clipboard
@Serializable
value class TimestampGranularity(val value: String)
Link copied to clipboard
@Serializable
data class Transcription(val text: String, val language: String? = null, val duration: Double? = null, val segments: List<Segment>? = null, val words: List<Word>? = null)

Create transcription response.

Link copied to clipboard

Automatic or explicitly configured server-side voice activity detection.

Link copied to clipboard
@Serializable
data class TranscriptionEvent(val type: String, val delta: String? = null, val text: String? = null, val logprobs: List<AudioLogprob>? = null, val usage: AudioUsage? = null, val segmentId: String? = null, val languages: List<TranscriptionLanguage>? = null, val id: String? = null, val speaker: String? = null, val start: Double? = null, val end: Double? = null)

Incremental transcription event, including delta, done and speaker segment events.

Link copied to clipboard
@Serializable
data class TranscriptionLanguage(val code: String)

A language detected in multilingual transcription.

Link copied to clipboard
data class TranscriptionOptions(val chunkingStrategy: TranscriptionChunkingStrategy? = null, val include: List<String>? = null, val keywords: List<String>? = null, val knownSpeakerNames: List<String>? = null, val knownSpeakerReferences: List<String>? = null, val languages: List<String>? = null)

Additional controls for modern transcription models.

Link copied to clipboard
class TranscriptionRequest(val audio: FileSource, val model: ModelId, val prompt: String? = null, val responseFormat: AudioResponseFormat? = null, val temperature: Double? = null, val language: String? = null, val timestampGranularities: List<TimestampGranularity>? = null)

Request to transcribe audio into the input language.

Link copied to clipboard
@Serializable
data class Translation(val text: String, val language: String? = null, val duration: Double? = null, val segments: List<Segment>? = null)

Create translation response.

Link copied to clipboard
class TranslationRequest(val audio: FileSource, val model: ModelId, val prompt: String? = null, val responseFormat: String? = null, val temperature: Double? = null)

Request to translate an audio into english.

Link copied to clipboard
Link copied to clipboard
@Serializable
value class Voice(val value: String)

The voice to use when generating the audio

Link copied to clipboard
@Serializable
data class Word(val word: String, val start: Double, val end: Double)

Functions

Link copied to clipboard

Creates a new SpeechRequest instance.

Link copied to clipboard

Creates a transcription request.

Link copied to clipboard

Creates a translation request.