Class SpeechCreateParams.Body
-
- All Implemented Interfaces:
public final class SpeechCreateParams.Body
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classSpeechCreateParams.Body.BuilderA builder for Body.
-
Method Summary
Modifier and Type Method Description final Stringinput()The text to generate audio for. final SpeechModelmodel()One of the available TTS models: tts-1,tts-1-hd,gpt-4o-mini-tts, orgpt-4o-mini-tts-2025-12-15.final SpeechCreateParams.Voicevoice()The voice to use when generating the audio. final Optional<String>instructions()Control the voice of your generated audio with additional instructions. final Optional<SpeechCreateParams.ResponseFormat>responseFormat()The format to audio in. final Optional<Double>speed()The speed of the generated audio. final Optional<SpeechCreateParams.StreamFormat>streamFormat()The format to stream the audio in. final JsonField<String>_input()Returns the raw JSON value of input. final JsonField<SpeechModel>_model()Returns the raw JSON value of model. final JsonField<SpeechCreateParams.Voice>_voice()Returns the raw JSON value of voice. final JsonField<String>_instructions()Returns the raw JSON value of instructions. final JsonField<SpeechCreateParams.ResponseFormat>_responseFormat()Returns the raw JSON value of responseFormat. final JsonField<Double>_speed()Returns the raw JSON value of speed. final JsonField<SpeechCreateParams.StreamFormat>_streamFormat()Returns the raw JSON value of streamFormat. final Map<String, JsonValue>_additionalProperties()final SpeechCreateParams.Body.BuildertoBuilder()final SpeechCreateParams.Bodyvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SpeechCreateParams.Body.Builderbuilder()Returns a mutable builder for constructing an instance of Body. -
-
Method Detail
-
model
final SpeechModel model()
One of the available TTS models:
tts-1,tts-1-hd,gpt-4o-mini-tts, orgpt-4o-mini-tts-2025-12-15.
-
voice
final SpeechCreateParams.Voice voice()
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, andcedar. You may also provide a custom voice object with anid, for example{ "id": "voice_1234" }. Previews of the voices are available in the Text to speech guide.
-
instructions
final Optional<String> instructions()
Control the voice of your generated audio with additional instructions. Does not work with
tts-1ortts-1-hd.
-
responseFormat
final Optional<SpeechCreateParams.ResponseFormat> responseFormat()
The format to audio in. Supported formats are
mp3,opus,aac,flac,wav, andpcm.
-
speed
final Optional<Double> speed()
The speed of the generated audio. Select a value from
0.25to4.0.1.0is the default.
-
streamFormat
final Optional<SpeechCreateParams.StreamFormat> streamFormat()
The format to stream the audio in. Supported formats are
sseandaudio.sseis not supported fortts-1ortts-1-hd.
-
_input
final JsonField<String> _input()
Returns the raw JSON value of input.
Unlike input, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<SpeechModel> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_voice
final JsonField<SpeechCreateParams.Voice> _voice()
Returns the raw JSON value of voice.
Unlike voice, this method doesn't throw if the JSON field has an unexpected type.
-
_instructions
final JsonField<String> _instructions()
Returns the raw JSON value of instructions.
Unlike instructions, this method doesn't throw if the JSON field has an unexpected type.
-
_responseFormat
final JsonField<SpeechCreateParams.ResponseFormat> _responseFormat()
Returns the raw JSON value of responseFormat.
Unlike responseFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_speed
final JsonField<Double> _speed()
Returns the raw JSON value of speed.
Unlike speed, this method doesn't throw if the JSON field has an unexpected type.
-
_streamFormat
final JsonField<SpeechCreateParams.StreamFormat> _streamFormat()
Returns the raw JSON value of streamFormat.
Unlike streamFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final SpeechCreateParams.Body.Builder toBuilder()
-
validate
final SpeechCreateParams.Body validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
builder
final static SpeechCreateParams.Body.Builder builder()
Returns a mutable builder for constructing an instance of Body.
The following fields are required:
.input() .model() .voice()
-
-
-
-