SpeechRequest class
A request to generate speech from text.
Uses the text-to-speech API to convert text into spoken audio.
Example
final request = SpeechRequest(
model: 'tts-1',
input: 'Hello, world!',
voice: SpeechVoice.alloy,
);
- Annotations
-
- @immutable
Constructors
- SpeechRequest({required String model, required String input, required SpeechVoice voice, SpeechResponseFormat? responseFormat, double? speed})
-
Creates a SpeechRequest.
const
-
SpeechRequest.fromJson(Map<
String, dynamic> json) -
Creates a SpeechRequest from JSON.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- input → String
-
The text to generate audio for.
final
- model → String
-
The TTS model to use.
final
- responseFormat → SpeechResponseFormat?
-
The audio format for the output.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed → double?
-
The speed of the generated audio.
final
- voice → SpeechVoice
-
The voice to use for speech generation.
final
Methods
-
copyWith(
{String? model, String? input, SpeechVoice? voice, Object? responseFormat = unsetCopyWithValue, Object? speed = unsetCopyWithValue}) → SpeechRequest - Creates a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts to JSON.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override