
    _j*                    L   S SK Jr  S SKJr  S SKJr  S SKrSSKJr  SSK	J
r
JrJrJrJrJrJr  SSKJrJr  SS	KJr  SS
KJrJr  SSKJrJrJrJr  SSKJr  SSK J!r!  SSK"J#r#  SS/r$ " S S\5      r% " S S\5      r& " S S5      r' " S S5      r( " S S5      r) " S S5      r*g)    )annotations)Union)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)StreamedBinaryAPIResponseAsyncStreamedBinaryAPIResponse#to_custom_streamed_response_wrapper)async_to_custom_streamed_response_wrapper)speech_create_params)make_request_options)SpeechModelSpeechAsyncSpeechc            	          \ rS rSrSr\S	S j5       r\S
S j5       r\\\\SSS\	S.                       SS jjr
Srg)r      (Turn audio into text or text into audio.c                    [        U 5      $ z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)SpeechWithRawResponseselfs    R/home/rurouni/.local/lib/python3.13/site-packages/openai/resources/audio/speech.pywith_raw_responseSpeech.with_raw_response   s     %T**    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)SpeechWithStreamingResponser#   s    r%   with_streaming_responseSpeech.with_streaming_response)   s     +400r(   Ninstructionsresponse_formatspeedstream_formatextra_headersextra_query
extra_bodytimeoutc                   SS0U=(       d    0 EnU R                  S[        UUUUUUUS.[        R                  5      [	        UU	U
USS0S9[
        R                  S9$ )	3  
Generates audio from the input text.

Returns the audio file content, or a stream of audio events.

Args:
  input: The text to generate audio for. The maximum length is 4096 characters.

  model:
      One of the available [TTS models](https://platform.openai.com/docs/models#tts):
      `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.

  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`, and `cedar`. You may also provide a custom voice
      object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
      voices are available in the
      [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).

  instructions: Control the voice of your generated audio with additional instructions. Does not
      work with `tts-1` or `tts-1-hd`.

  response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
      `wav`, and `pcm`.

  speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
      the default.

  stream_format: The format to stream the audio in. Supported formats are `sse` and `audio`.
      `sse` is not supported for `tts-1` or `tts-1-hd`.

  extra_headers: Send extra headers

  extra_query: Add additional query parameters to the request

  extra_body: Add additional JSON properties to the request

  timeout: Override the client-level default timeout for this request, in seconds
Acceptapplication/octet-stream/audio/speechinputmodelvoicer/   r0   r1   r2   bearer_authTr3   r4   r5   r6   securitybodyoptionscast_to)_postr   r   SpeechCreateParamsr   r   HttpxBinaryResponseContentr$   r=   r>   r?   r/   r0   r1   r2   r3   r4   r5   r6   s               r%   createSpeech.create2   s    p "#=W-BUSUWzz """$0'6"%2 %77 )+'%'. %??+  
 	
r(    )returnr"   )rN   r+   r=   strr>   zUnion[str, SpeechModel]r?   zspeech_create_params.Voicer/   z
str | Omitr0   z:Literal['mp3', 'opus', 'aac', 'flac', 'wav', 'pcm'] | Omitr1   zfloat | Omitr2   zLiteral['sse', 'audio'] | Omitr3   zHeaders | Noner4   zQuery | Noner5   zBody | Noner6   z'float | httpx.Timeout | None | NotGivenrN   z+_legacy_response.HttpxBinaryResponseContent__name__
__module____qualname____firstlineno____doc__r   r&   r,   r   r   rK   __static_attributes__rM   r(   r%   r   r      s    2+ + 1 1 $(VZ"8< )-$("&;DO
 O
 '	O

 *O
 !O
 TO
 O
 6O
 &O
 "O
  O
 9O
  
5!O
 O
r(   c            	          \ rS rSrSr\S	S j5       r\S
S j5       r\\\\SSS\	S.                       SS jjr
Srg)r      r   c                    [        U 5      $ r!   )AsyncSpeechWithRawResponser#   s    r%   r&   AsyncSpeech.with_raw_response   s     *$//r(   c                    [        U 5      $ r*   ) AsyncSpeechWithStreamingResponser#   s    r%   r,   #AsyncSpeech.with_streaming_response   s     055r(   Nr.   c                  #    SS0U=(       d    0 EnU R                  S[        UUUUUUUS.[        R                  5      I Sh  vN [	        UU	U
USS0S9[
        R                  S	9I Sh  vN $  N+ N7f)
r8   r9   r:   r;   r<   Nr@   TrA   rC   )rG   r   r   rH   r   r   rI   rJ   s               r%   rK   AsyncSpeech.create   s     p "#=W-BUSUWZZ,"""$0'6"%2 %77  )+'%'. %??+   
 
 	

s$   AA3A/
&A3*A1+A31A3rM   )rN   r[   )rN   r^   rO   rQ   rM   r(   r%   r   r      s    20 0 6 6 $(VZ"8< )-$("&;DO
 O
 '	O

 *O
 !O
 TO
 O
 6O
 &O
 "O
  O
 9O
  
5!O
 O
r(   c                      \ rS rSrSS jrSrg)r"      c                Z    Xl         [        R                  " UR                  5      U l        g N)_speechr   to_raw_response_wrapperrK   r$   speechs     r%   __init__SpeechWithRawResponse.__init__   s     &>>MM
r(   rf   rK   Nri   r   rN   NonerR   rS   rT   rU   rj   rW   rM   r(   r%   r"   r"          
r(   r"   c                      \ rS rSrSS jrSrg)r[      c                Z    Xl         [        R                  " UR                  5      U l        g re   )rf   r   async_to_raw_response_wrapperrK   rh   s     r%   rj   #AsyncSpeechWithRawResponse.__init__   s     &DDMM
r(   rl   Nri   r   rN   rn   ro   rM   r(   r%   r[   r[      rp   r(   r[   c                      \ rS rSrSS jrSrg)r+      c                N    Xl         [        UR                  [        5      U l        g re   )rf   r   rK   r   rh   s     r%   rj   $SpeechWithStreamingResponse.__init__   s    9MM%
r(   rl   Nrm   ro   rM   r(   r%   r+   r+          
r(   r+   c                      \ rS rSrSS jrSrg)r^   i  c                N    Xl         [        UR                  [        5      U l        g re   )rf   r   rK   r   rh   s     r%   rj   )AsyncSpeechWithStreamingResponse.__init__	  s    ?MM*
r(   rl   Nrv   ro   rM   r(   r%   r^   r^     r{   r(   r^   )+
__future__r   typingr   typing_extensionsr   httpx r   _typesr   r	   r
   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   types.audior   _base_clientr   types.audio.speech_modelr   __all__r   r   r"   r[   r+   r^   rM   r(   r%   <module>r      s    #  %    K K K < & :  0 0 3]
#e
_ e
Pe
" e
P
 

 

 

 
r(   