Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/openai_deno/mod.ts>OpenAI#createSpeech

OpenAI API wrapper for deno.
Latest
method OpenAI.prototype.createSpeech
import { OpenAI } from "https://deno.land/x/openai_deno@v0.9.8/mod.ts";

Generates audio from the input text.

Parameters

model: "tts-1" | "tts-1-hd" | string

One of the available TTS models: tts-1 or tts-1-hd

input: string

The text to generate audio for. The maximum length is 4096 characters.

voice:
| "alloy"
| "echo"
| "fable"
| "onyx"
| "nova"
| "shimmer"
| string

The voice to use when generating the audio. Supported voices are alloy, echo, fable, onyx, nova, and shimmer.

optional
params: CreateSpeechParams

Optional parameters for the API.

Returns

Promise<Blob>

The audio file content.