Class SpeechCreateParams
-
- All Implemented Interfaces:
-
com.openai.core.Params
public final class SpeechCreateParams implements Params
Generates audio from the input text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
SpeechCreateParams.Builder
A builder for SpeechCreateParams.
public final class
SpeechCreateParams.Body
public final class
SpeechCreateParams.Voice
The voice to use when generating the audio. Supported voices are
alloy
,ash
,ballad
,coral
,echo
,fable
,onyx
,nova
,sage
,shimmer
, andverse
. Previews of the voices are available in the Text to speech guide.public final class
SpeechCreateParams.ResponseFormat
The format to audio in. Supported formats are
mp3
,opus
,aac
,flac
,wav
, andpcm
.
-
Method Summary
Modifier and Type Method Description final String
input()
The text to generate audio for. final SpeechModel
model()
One of the available TTS models: tts-1
,tts-1-hd
orgpt-4o-mini-tts
.final SpeechCreateParams.Voice
voice()
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 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 Map<String, JsonValue>
_additionalBodyProperties()
final Headers
_additionalHeaders()
final QueryParams
_additionalQueryParams()
final SpeechCreateParams.Builder
toBuilder()
final SpeechCreateParams.Body
_body()
Headers
_headers()
The full set of headers in the parameters, including both fixed and additional headers. QueryParams
_queryParams()
The full set of query params in the parameters, including both fixed and additional query params. Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static SpeechCreateParams.Builder
builder()
Returns a mutable builder for constructing an instance of SpeechCreateParams. -
-
Method Detail
-
model
final SpeechModel model()
One of the available TTS models:
tts-1
,tts-1-hd
orgpt-4o-mini-tts
.
-
voice
final SpeechCreateParams.Voice voice()
The voice to use when generating the audio. Supported voices are
alloy
,ash
,ballad
,coral
,echo
,fable
,onyx
,nova
,sage
,shimmer
, andverse
. 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-1
ortts-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.25
to4.0
.1.0
is the default. Does not work withgpt-4o-mini-tts
.
-
_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.
-
_additionalBodyProperties
final Map<String, JsonValue> _additionalBodyProperties()
-
_additionalHeaders
final Headers _additionalHeaders()
-
_additionalQueryParams
final QueryParams _additionalQueryParams()
-
toBuilder
final SpeechCreateParams.Builder toBuilder()
-
_body
final SpeechCreateParams.Body _body()
-
_headers
Headers _headers()
The full set of headers in the parameters, including both fixed and additional headers.
-
_queryParams
QueryParams _queryParams()
The full set of query params in the parameters, including both fixed and additional query params.
-
builder
final static SpeechCreateParams.Builder builder()
Returns a mutable builder for constructing an instance of SpeechCreateParams.
The following fields are required:
.input() .model() .voice()
-
-
-
-