Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Create voice

client.audio.voices.create(body, options?): Voice { id, created_at, name, 3 more }
POST
/audio/voices

Creates a voice from a text prompt or from a consent recording and an audio sample.

For prompt-based creation, send type: "prompt" with a name and prompt as JSON or multipart form data. For creation from an audio sample, send type: "audio_sample" with a name, audio_sample, and consent recording ID as multipart form data. The type defaults to audio_sample when omitted.

Returns the saved voice’s metadata. Voices created from text prompts are supported only in Live, not in Realtime or the speech endpoint. The response does not include preview audio.

Parameters
VoiceCreateParams = Consent | Prompt { name, prompt, type, 2 more }
VoiceCreateParamsBase { audio_sample, consent, name, type }
Consent extends VoiceCreateParamsBase { audio_sample, consent, name, type }
Prompt { name, prompt, type, 2 more }
Returns
Voice { id, created_at, name, 3 more }

A custom voice that can be used for audio output. Voices created from text prompts are supported only in Live.

id: string

The voice identifier, which can be referenced in API endpoints.

created_at: number

The Unix timestamp (in seconds) for when the voice was created.

formatunixtime
name: string

The name of the voice.

object: "audio.voice"

The object type, which is always audio.voice.

type: "audio_sample" | "prompt"

How the voice was created.

prompt?: string

The original text prompt used to create the voice. Present for prompt-generated voices with a stored prompt; omitted for audio-sample voices and older voices without a stored prompt.

Create voice

import fs from 'fs';
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

const voice = await client.audio.voices.create({
  audio_sample: fs.createReadStream('path/to/file'),
  consent: 'consent',
  name: 'x',
});

console.log(voice.id);
200 — Example
{
  "id": "id",
  "created_at": 0,
  "name": "name",
  "object": "audio.voice",
  "type": "audio_sample",
  "prompt": "prompt"
}
Returns Examples
200 — Example
{
  "id": "id",
  "created_at": 0,
  "name": "name",
  "object": "audio.voice",
  "type": "audio_sample",
  "prompt": "prompt"
}