| external help file | PSOpenAI-help.xml |
|---|---|
| Module Name | PSOpenAI |
| online version | https://github.com/mkht/PSOpenAI/blob/main/Docs/Request-AudioSpeech.md |
| schema | 2.0.0 |
Generates audio from the input text.
Request-AudioSpeech
[-Text] <String>
[-Model <String>]
[-Voice <String>]
[-Instructions <String>]
[-ResponseFormat <String>]
-OutFile <String>
[-Speed <Double>]
[-TimeoutSec <Int32>]
[-MaxRetryCount <Int32>]
[-ApiBase <Uri>]
[-ApiKey <Object>]
[-Organization <String>]
[<CommonParameters>]
Generates audio from the input text.
https://developers.openai.com/api/docs/guides/text-to-speech/
Request-AudioSpeech -Text 'Hello.' -OutFile 'C:\sample\audio.mp3'Request-AudioSpeech `
-Text 'The quick brown fox jumped over the lazy dog.' `
-OutFile 'C:\sample\audio.aac' `
-Model tts-1-hd `
-Voice Onyx `
-Speed 1.2(Required)
The text to generate audio for. The maximum length is 4096 characters.
Type: String
Aliases: Input
Required: True
Position: 0
Accept pipeline input: True (ByValue)One of the available TTS models: tts-1, tts-1-hd or gpt-4o-mini-tts.
The default value is tts-1.
Type: String
Required: False
Position: Named
Default value: tts-1The voice to use when generating the audio. Supported voices are alloy, ash, coral, echo, fable, onyx, nova, sage and shimmer.
The default value is alloy.
Type: String
Required: False
Position: Named
Default value: alloyControl the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.
Type: String
Required: True
Position: NamedThe format of audio. Supported formats are mp3, opus, aac, flac, wav, and pcm
Type: String
Aliases: response_format
Required: False
Position: Named(Required)
The path of the file to save.
Type: String
Required: True
Position: NamedThe speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.
Type: Double
Required: False
Position: Named
Default value: 1.0Specifies how long the request can be pending before it times out.
The default value is 0 (infinite).
Type: Int32
Required: False
Position: Named
Default value: 0Number between 0 and 100.
Specifies the maximum number of retries if the request fails. The default value is 0 (No retry).
Note : Retries will only be performed if the request fails with a 429 (Rate limit reached) or 5xx (Server side errors) error. Other errors (e.g., authentication failure) will not be performed.
Type: Int32
Required: False
Position: Named
Default value: 0Specifies an API endpoint URL such like: https://your-api-endpoint.test/v1
If not specified, it will use https://api.openai.com/v1
Type: System.Uri
Required: False
Position: Named
Default value: https://api.openai.com/v1Specifies API key for authentication.
The type of data should [string] or [securestring].
If not specified, it will try to use $global:OPENAI_API_KEY or $env:OPENAI_API_KEY
Type: Object
Required: False
Position: NamedSpecifies Organization ID which used for an API request.
If not specified, it will try to use $global:OPENAI_ORGANIZATION or $env:OPENAI_ORGANIZATION
Type: string
Aliases: OrgId
Required: False
Position: Namedhttps://developers.openai.com/api/docs/guides/text-to-speech/
https://developers.openai.com/api/reference/resources/audio/subresources/speech/methods/create/