Class SpeechCreateParams.Builder
-
- All Implemented Interfaces:
public final class SpeechCreateParams.Builder
A builder for SpeechCreateParams.
-
-
Method Summary
-
-
Method Detail
-
body
final SpeechCreateParams.Builder body(SpeechCreateParams.Body body)
Sets the entire request body.
This is generally only useful if you are already constructing the body separately. Otherwise, it's more convenient to use the top-level setters instead:
-
input
final SpeechCreateParams.Builder input(String input)
The text to generate audio for. The maximum length is 4096 characters.
-
input
final SpeechCreateParams.Builder input(JsonField<String> input)
Sets Builder.input to an arbitrary JSON value.
You should usually call Builder.input with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final SpeechCreateParams.Builder model(SpeechModel model)
One of the available TTS models:
tts-1
,tts-1-hd
orgpt-4o-mini-tts
.
-
model
final SpeechCreateParams.Builder model(JsonField<SpeechModel> model)
Sets Builder.model to an arbitrary JSON value.
You should usually call Builder.model with a well-typed SpeechModel value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
model
final SpeechCreateParams.Builder model(String value)
Sets model to an arbitrary String.
You should usually call model with a well-typed SpeechModel constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
voice
final SpeechCreateParams.Builder voice(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.
-
voice
final SpeechCreateParams.Builder voice(JsonField<SpeechCreateParams.Voice> voice)
Sets Builder.voice to an arbitrary JSON value.
You should usually call Builder.voice with a well-typed Voice value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
voice
final SpeechCreateParams.Builder voice(String value)
Sets voice to an arbitrary String.
You should usually call voice with a well-typed Voice constant instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
instructions
final SpeechCreateParams.Builder instructions(String instructions)
Control the voice of your generated audio with additional instructions. Does not work with
tts-1
ortts-1-hd
.
-
instructions
final SpeechCreateParams.Builder instructions(JsonField<String> instructions)
Sets Builder.instructions to an arbitrary JSON value.
You should usually call Builder.instructions with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
responseFormat
final SpeechCreateParams.Builder responseFormat(SpeechCreateParams.ResponseFormat responseFormat)
The format to audio in. Supported formats are
mp3
,opus
,aac
,flac
,wav
, andpcm
.
-
responseFormat
final SpeechCreateParams.Builder responseFormat(JsonField<SpeechCreateParams.ResponseFormat> responseFormat)
Sets Builder.responseFormat to an arbitrary JSON value.
You should usually call Builder.responseFormat with a well-typed ResponseFormat value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
speed
final SpeechCreateParams.Builder speed(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
.
-
speed
final SpeechCreateParams.Builder speed(JsonField<Double> speed)
Sets Builder.speed to an arbitrary JSON value.
You should usually call Builder.speed with a well-typed Double value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalBodyProperties
final SpeechCreateParams.Builder additionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
putAdditionalBodyProperty
final SpeechCreateParams.Builder putAdditionalBodyProperty(String key, JsonValue value)
-
putAllAdditionalBodyProperties
final SpeechCreateParams.Builder putAllAdditionalBodyProperties(Map<String, JsonValue> additionalBodyProperties)
-
removeAdditionalBodyProperty
final SpeechCreateParams.Builder removeAdditionalBodyProperty(String key)
-
removeAllAdditionalBodyProperties
final SpeechCreateParams.Builder removeAllAdditionalBodyProperties(Set<String> keys)
-
additionalHeaders
final SpeechCreateParams.Builder additionalHeaders(Headers additionalHeaders)
-
additionalHeaders
final SpeechCreateParams.Builder additionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
putAdditionalHeader
final SpeechCreateParams.Builder putAdditionalHeader(String name, String value)
-
putAdditionalHeaders
final SpeechCreateParams.Builder putAdditionalHeaders(String name, Iterable<String> values)
-
putAllAdditionalHeaders
final SpeechCreateParams.Builder putAllAdditionalHeaders(Headers additionalHeaders)
-
putAllAdditionalHeaders
final SpeechCreateParams.Builder putAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
replaceAdditionalHeaders
final SpeechCreateParams.Builder replaceAdditionalHeaders(String name, String value)
-
replaceAdditionalHeaders
final SpeechCreateParams.Builder replaceAdditionalHeaders(String name, Iterable<String> values)
-
replaceAllAdditionalHeaders
final SpeechCreateParams.Builder replaceAllAdditionalHeaders(Headers additionalHeaders)
-
replaceAllAdditionalHeaders
final SpeechCreateParams.Builder replaceAllAdditionalHeaders(Map<String, Iterable<String>> additionalHeaders)
-
removeAdditionalHeaders
final SpeechCreateParams.Builder removeAdditionalHeaders(String name)
-
removeAllAdditionalHeaders
final SpeechCreateParams.Builder removeAllAdditionalHeaders(Set<String> names)
-
additionalQueryParams
final SpeechCreateParams.Builder additionalQueryParams(QueryParams additionalQueryParams)
-
additionalQueryParams
final SpeechCreateParams.Builder additionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
putAdditionalQueryParam
final SpeechCreateParams.Builder putAdditionalQueryParam(String key, String value)
-
putAdditionalQueryParams
final SpeechCreateParams.Builder putAdditionalQueryParams(String key, Iterable<String> values)
-
putAllAdditionalQueryParams
final SpeechCreateParams.Builder putAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
putAllAdditionalQueryParams
final SpeechCreateParams.Builder putAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
replaceAdditionalQueryParams
final SpeechCreateParams.Builder replaceAdditionalQueryParams(String key, String value)
-
replaceAdditionalQueryParams
final SpeechCreateParams.Builder replaceAdditionalQueryParams(String key, Iterable<String> values)
-
replaceAllAdditionalQueryParams
final SpeechCreateParams.Builder replaceAllAdditionalQueryParams(QueryParams additionalQueryParams)
-
replaceAllAdditionalQueryParams
final SpeechCreateParams.Builder replaceAllAdditionalQueryParams(Map<String, Iterable<String>> additionalQueryParams)
-
removeAdditionalQueryParams
final SpeechCreateParams.Builder removeAdditionalQueryParams(String key)
-
removeAllAdditionalQueryParams
final SpeechCreateParams.Builder removeAllAdditionalQueryParams(Set<String> keys)
-
build
final SpeechCreateParams build()
Returns an immutable instance of SpeechCreateParams.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.input() .model() .voice()
-
-
-
-