Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
schema_version: 1
generation_id: fd87a332-8b41-4969-82ea-bee78e04c9b0
openapi_spec_hash: f0ac7c2da11e51bf51fe8f65e5b313b9
openapi_transformed_spec_hash: 90042e27fae59af49799aee80b3882b0
config_hash: 3336a08a5a6cf26a723db96a2602e503
codegen_sha: c76b241333d2b0ecd43eb9f8a4bc308fea1defa1
codegen_hash: 12b19e5d66cb42739f0d86618cd872d65c9067cfcf395cef3c9fbf2bfd359de1
public_codegen_sha: 4dd493cf89ad33dd52f93d8e2485f8ed7a4fdede
generation_id: c67fe055-5fef-4490-a93e-212d8568459a
openapi_spec_hash: 9585fb5cd9d39a73de012b8de53b088a
openapi_transformed_spec_hash: c497de66b4332c26986df2cb087da34a
config_hash: 075dc8d5c682945dd2c56e77607736a1
codegen_sha: c9f081c5aff42abd96fb8a2bb6aa0cb3edb29ce0
codegen_hash: 1752270cf5c4363ac5590798437d9abe9a17fc97188f305211630acb2dc1ce4d
public_codegen_sha: 9b09f5dcd2bec975a9539d4d08f4b87358de65e8
93 changes: 23 additions & 70 deletions api_reference/openapi.transformed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1691,11 +1691,11 @@ paths:
- Audio
summary: Create voice
description: |
Creates a voice from a text prompt or from a consent recording and an audio sample.
Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.

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.
Send `name`, `audio_sample`, and the `consent` recording ID as multipart form data. The optional `type` defaults to `audio_sample`.

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.
Returns the saved voice's metadata. See the [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
requestBody:
required: true
content:
Expand All @@ -1710,7 +1710,7 @@ paths:
schema:
$ref: '#/components/schemas/VoiceResource'
'400':
description: Invalid voice request, prompt, script hint, model, consent recording, or audio sample.
description: Invalid voice request, consent recording, or audio sample.
content:
application/json:
schema:
Expand All @@ -1735,13 +1735,9 @@ paths:
curl https://api.openai.com/v1/audio/voices \
-X POST \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "prompt",
"name": "Warm narrator",
"prompt": "A warm, calm narrator with a clear, measured delivery.",
"model": "auto"
}'
-F "name=My new voice" \
-F "consent=cons_1234" \
-F "audio_sample=@audio_sample.wav;type=audio/x-wav"
/batches:
post:
summary: Create batch
Expand Down Expand Up @@ -40805,8 +40801,7 @@ components:
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`,
`sage`, `shimmer`, `marin`, and `cedar`. You may also provide a
custom voice object with an `id`, for example `{ "id": "voice_1234" }`.
Custom voices must be created from audio samples. Voices created from text
prompts are supported only in Live.
Custom voices must be created from audio samples.
format:
type: string
enum:
Expand Down Expand Up @@ -43646,7 +43641,7 @@ components:
description: Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
maxLength: 4096
voice:
description: 'The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.'
description: 'The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples.'
title: Voice
anyOf:
- anyOf:
Expand Down Expand Up @@ -44531,55 +44526,6 @@ components:
- name
- audio_sample
- consent
CreateVoicePromptRequest:
type: object
title: Prompt
description: Creates a synthetic voice from a text description. Supports application/json or multipart/form-data.
additionalProperties: false
properties:
type:
type: string
enum:
- prompt
description: Set to `prompt` to create a voice from a text description.
name:
type: string
minLength: 1
maxLength: 256
description: The name of the new voice.
prompt:
type: string
minLength: 1
maxLength: 2000
description: A description of the desired voice. Must not contain only whitespace.
script_hint:
type: string
minLength: 1
maxLength: 2000
description: Optional text for the voice to speak during creation. If omitted, a script is generated from the prompt. Must not be blank after trimming whitespace; scripts that are too short are rejected.
model:
anyOf:
- type: string
- type: string
enum:
- auto
- 2026-10-01
default: auto
description: The voice creation model to use. Defaults to `auto`.
required:
- type
- name
- prompt
CreateVoiceRequest:
discriminator:
propertyName: type
mapping:
audio_sample: '#/components/schemas/CreateVoiceFromConsentRequest'
prompt: '#/components/schemas/CreateVoicePromptRequest'
x-oai-default-discriminator-value: audio_sample
anyOf:
- $ref: '#/components/schemas/CreateVoiceFromConsentRequest'
- $ref: '#/components/schemas/CreateVoicePromptRequest'
CustomToolCall:
type: object
title: Custom tool call
Expand Down Expand Up @@ -54173,7 +54119,7 @@ components:
`marin`, and `cedar`. You may also provide a custom voice object with an
`id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during
the session once the model has responded with audio at least once.
Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
Custom voices must be created from audio samples.
output_audio_format:
type: string
enum:
Expand Down Expand Up @@ -57514,7 +57460,7 @@ components:
`marin`, and `cedar`. You may also provide a custom voice object with
an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed
during the session once the model has responded with audio at least once.
Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
Custom voices must be created from audio samples.
We recommend `marin` and `cedar` for best quality.
tools:
type: array
Expand Down Expand Up @@ -60087,7 +60033,7 @@ components:
`marin`, and `cedar`. You may also provide a custom voice object with an
`id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during
the session once the model has responded with audio at least once.
Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
Custom voices must be created from audio samples.
input_audio_format:
type: string
description: |
Expand Down Expand Up @@ -60367,7 +60313,7 @@ components:
`marin`, and `cedar`. You may also provide a custom voice object with
an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed
during the session once the model has responded with audio at least once.
Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
Custom voices must be created from audio samples.
We recommend `marin` and `cedar` for best quality.
speed:
type: number
Expand Down Expand Up @@ -70985,7 +70931,7 @@ components:
VoiceResource:
type: object
title: Voice
description: A custom voice that can be used for audio output. Voices created from text prompts are supported only in Live.
description: A custom voice that can be used for audio output.
additionalProperties: false
properties:
object:
Expand All @@ -70998,11 +70944,10 @@ components:
type: string
description: The voice identifier, which can be referenced in API endpoints.
type:
description: How the voice was created.
type: string
description: How the voice was created. Voices created from text prompts are supported only in Live.
enum:
- audio_sample
- prompt
name:
type: string
description: The name of the voice.
Expand Down Expand Up @@ -104418,6 +104363,14 @@ components:
- $ref: '#/components/schemas/BetaResponseCustomToolCallInputDoneEvent'
discriminator:
propertyName: type
CreateVoiceRequest:
discriminator:
propertyName: type
mapping:
audio_sample: '#/components/schemas/CreateVoiceFromConsentRequest'
x-oai-default-discriminator-value: audio_sample
anyOf:
- $ref: '#/components/schemas/CreateVoiceFromConsentRequest'
OAuthErrorCode:
anyOf:
- enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ private constructor(
* `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id":
* "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
Expand Down Expand Up @@ -253,8 +252,7 @@ private constructor(
* and `cedar`. You may also provide a custom voice object with an `id`, for example `{
* "id": "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*/
fun voice(voice: Voice) = apply { body.voice(voice) }

Expand Down Expand Up @@ -550,8 +548,7 @@ private constructor(
* and `cedar`. You may also provide a custom voice object with an `id`, for example `{
* "id": "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
Expand Down Expand Up @@ -748,8 +745,7 @@ private constructor(
* `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in
* the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts
* are supported only in Live.
* Custom voices must be created from audio samples.
*/
fun voice(voice: Voice) = voice(JsonField.of(voice))

Expand Down Expand Up @@ -975,8 +971,7 @@ private constructor(
* `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id":
* "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*/
@JsonDeserialize(using = Voice.Deserializer::class)
@JsonSerialize(using = Voice.Serializer::class)
Expand All @@ -996,8 +991,7 @@ private constructor(
* and `cedar`. You may also provide a custom voice object with an `id`, for example `{
* "id": "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*/
fun unionMember1(): Optional<UnionMember1> = Optional.ofNullable(unionMember1)

Expand All @@ -1018,8 +1012,7 @@ private constructor(
* and `cedar`. You may also provide a custom voice object with an `id`, for example `{
* "id": "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*/
fun asUnionMember1(): UnionMember1 = unionMember1.getOrThrow("unionMember1")

Expand Down Expand Up @@ -1159,8 +1152,7 @@ private constructor(
* `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in
* the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts
* are supported only in Live.
* Custom voices must be created from audio samples.
*/
@JvmStatic
fun ofUnionMember1(unionMember1: UnionMember1) = Voice(unionMember1 = unionMember1)
Expand All @@ -1181,8 +1173,7 @@ private constructor(
* `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in
* the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts
* are supported only in Live.
* Custom voices must be created from audio samples.
*/
fun visitUnionMember1(unionMember1: UnionMember1): T

Expand Down Expand Up @@ -1260,8 +1251,7 @@ private constructor(
* and `cedar`. You may also provide a custom voice object with an `id`, for example `{
* "id": "voice_1234" }`. Previews of the voices are available in the
* [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
* Custom voices must be created from audio samples. Voices created from text prompts are
* supported only in Live.
* Custom voices must be created from audio samples.
*/
class UnionMember1 @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import java.util.Collections
import java.util.Objects
import kotlin.jvm.optionals.getOrNull

/**
* A custom voice that can be used for audio output. Voices created from text prompts are supported
* only in Live.
*/
/** A custom voice that can be used for audio output. */
class Voice
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
Expand Down Expand Up @@ -79,7 +76,7 @@ private constructor(
@JsonProperty("object") @ExcludeMissing fun _object_(): JsonValue = object_

/**
* How the voice was created. Voices created from text prompts are supported only in Live.
* How the voice was created.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
Expand Down Expand Up @@ -209,9 +206,7 @@ private constructor(
*/
fun object_(object_: JsonValue) = apply { this.object_ = object_ }

/**
* How the voice was created. Voices created from text prompts are supported only in Live.
*/
/** How the voice was created. */
fun type(type: Type) = type(JsonField.of(type))

/**
Expand Down Expand Up @@ -315,7 +310,7 @@ private constructor(
object_.let { if (it == JsonValue.from("audio.voice")) 1 else 0 } +
(type.asKnown().getOrNull()?.validity() ?: 0)

/** How the voice was created. Voices created from text prompts are supported only in Live. */
/** How the voice was created. */
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

/**
Expand All @@ -332,15 +327,12 @@ private constructor(

@JvmField val AUDIO_SAMPLE = of("audio_sample")

@JvmField val PROMPT = of("prompt")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
}

/** An enum containing [Type]'s known values. */
enum class Known {
AUDIO_SAMPLE,
PROMPT,
AUDIO_SAMPLE
}

/**
Expand All @@ -354,7 +346,6 @@ private constructor(
*/
enum class Value {
AUDIO_SAMPLE,
PROMPT,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
}
Expand All @@ -369,7 +360,6 @@ private constructor(
fun value(): Value =
when (this) {
AUDIO_SAMPLE -> Value.AUDIO_SAMPLE
PROMPT -> Value.PROMPT
else -> Value._UNKNOWN
}

Expand All @@ -385,7 +375,6 @@ private constructor(
fun known(): Known =
when (this) {
AUDIO_SAMPLE -> Known.AUDIO_SAMPLE
PROMPT -> Known.PROMPT
else -> throw OpenAIInvalidDataException("Unknown Type: $value")
}

Expand Down
Loading
Loading