Update README.md with new local endpoint usage example

The old method will result in a deprecation warning, this is the recommended method via openAI.

```python
    @deprecated(
        "Due to a bug, this method doesn't actually stream the response content, `.with_streaming_response.method()` should be used instead"
    )
    def stream_to_file(
...
```
This commit is contained in:
Jelle Teijema 2025-01-14 15:53:39 +01:00 committed by GitHub
parent 880fa7ad53
commit a51ea53b50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,13 +56,14 @@ The service can be accessed through either the API endpoints or the Gradio web i
api_key="not-needed"
)
response = client.audio.speech.create(
with client.audio.speech.with_streaming_response.create(
model="kokoro",
voice="af_sky+af_bella", #single or multiple voicepack combo
input="Hello world!",
response_format="mp3"
)
response.stream_to_file("output.mp3")
) as response:
response.stream_to_file("output.mp3")
```
or visit http://localhost:7860