speechify-api 2.0.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {speechify_api-2.0.0 → speechify_api-2.0.1}/PKG-INFO +30 -6
- {speechify_api-2.0.0 → speechify_api-2.0.1}/README.md +28 -4
- {speechify_api-2.0.0 → speechify_api-2.0.1}/pyproject.toml +1 -1
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/__init__.py +15 -18
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/client.py +80 -34
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/raw_client.py +70 -26
- speechify_api-2.0.1/src/speechify/audio/types/get_speech_request_model.py +7 -0
- speechify_api-2.0.1/src/speechify/audio/types/get_stream_request_model.py +7 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/client.py +20 -12
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/__init__.py +5 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/client_wrapper.py +21 -13
- speechify_api-2.0.1/src/speechify/core/pagination.py +82 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/__init__.py +3 -0
- speechify_api-2.0.1/src/speechify/errors/conflict_error.py +10 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/__init__.py +12 -18
- speechify_api-2.0.1/src/speechify/types/audio_output_format.py +30 -0
- speechify_api-2.0.1/src/speechify/types/audio_stream_output_format.py +28 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/error_code.py +11 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/error_detail.py +10 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_speech_response.py +7 -1
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_speech_response_audio_format.py +1 -1
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_voice_gender.py +1 -1
- speechify_api-2.0.1/src/speechify/types/get_voices_model_name.py +7 -0
- speechify_api-2.0.1/src/speechify/types/list_voices_response.py +29 -0
- speechify_api-2.0.1/src/speechify/types/pagination_meta.py +36 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/voices/client.py +197 -45
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/voices/raw_client.py +413 -40
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/voices/types/create_voices_request_gender.py +1 -1
- speechify_api-2.0.0/src/speechify/audio/types/get_speech_request_model.py +0 -5
- speechify_api-2.0.0/src/speechify/audio/types/get_stream_request_model.py +0 -5
- speechify_api-2.0.0/src/speechify/types/create_voice_language.py +0 -20
- speechify_api-2.0.0/src/speechify/types/create_voice_model.py +0 -22
- speechify_api-2.0.0/src/speechify/types/create_voice_model_name.py +0 -5
- speechify_api-2.0.0/src/speechify/types/created_voice.py +0 -28
- speechify_api-2.0.0/src/speechify/types/created_voice_gender.py +0 -5
- speechify_api-2.0.0/src/speechify/types/created_voice_type.py +0 -5
- speechify_api-2.0.0/src/speechify/types/get_voices_model_name.py +0 -5
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/_default_clients.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/__init__.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/types/__init__.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/types/get_speech_request_audio_format.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/audio/types/stream_audio_request_accept.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/api_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/datetime_utils.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/file.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/force_multipart.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_client.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_response.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_sse/__init__.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_sse/_api.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_sse/_decoders.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_sse/_exceptions.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/http_sse/_models.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/jsonable_encoder.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/logging.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/parse_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/pydantic_utilities.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/query_encoder.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/remove_none_from_dict.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/request_options.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/core/serialization.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/environment.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/bad_gateway_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/bad_request_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/forbidden_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/internal_server_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/not_found_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/payment_required_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/service_unavailable_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/too_many_requests_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/unauthorized_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/errors/unprocessable_entity_error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/py.typed +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/error.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_speech_options_request.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_stream_options_request.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_voice.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_voice_language.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_voice_type.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/get_voices_model.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/nested_chunk.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/types/speech_marks.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/version.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/voices/__init__.py +0 -0
- {speechify_api-2.0.0 → speechify_api-2.0.1}/src/speechify/voices/types/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: speechify-api
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Official Speechify API SDK
|
|
5
5
|
Keywords: speechify,ai,api,sdk,text-to-speech,tts
|
|
6
6
|
Author: Speechify
|
|
@@ -34,12 +34,12 @@ Project-URL: Homepage, https://docs.speechify.ai
|
|
|
34
34
|
Project-URL: Repository, https://github.com/speechifyinc/speechify-api-sdk-python
|
|
35
35
|
Description-Content-Type: text/markdown
|
|
36
36
|
|
|
37
|
-
#
|
|
37
|
+
# Speechify Python Library
|
|
38
38
|
|
|
39
39
|
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fspeechifyinc%2Fspeechify-api-sdk-python)
|
|
40
40
|
[](https://pypi.python.org/pypi/speechify-api)
|
|
41
41
|
|
|
42
|
-
The
|
|
42
|
+
The Speechify Python library provides convenient access to the Speechify APIs from Python.
|
|
43
43
|
|
|
44
44
|
## Table of Contents
|
|
45
45
|
|
|
@@ -50,6 +50,7 @@ The Speechifyinc Python library provides convenient access to the Speechifyinc A
|
|
|
50
50
|
- [Environments](#environments)
|
|
51
51
|
- [Async Client](#async-client)
|
|
52
52
|
- [Exception Handling](#exception-handling)
|
|
53
|
+
- [Pagination](#pagination)
|
|
53
54
|
- [Advanced](#advanced)
|
|
54
55
|
- [Access Raw Response Data](#access-raw-response-data)
|
|
55
56
|
- [Retries](#retries)
|
|
@@ -79,7 +80,7 @@ Instantiate and use the client with the following:
|
|
|
79
80
|
from speechify import Speechify
|
|
80
81
|
|
|
81
82
|
client = Speechify(
|
|
82
|
-
|
|
83
|
+
token="<token>",
|
|
83
84
|
)
|
|
84
85
|
|
|
85
86
|
client.audio.speech(
|
|
@@ -113,7 +114,7 @@ import asyncio
|
|
|
113
114
|
from speechify import AsyncSpeechify
|
|
114
115
|
|
|
115
116
|
client = AsyncSpeechify(
|
|
116
|
-
|
|
117
|
+
token="<token>",
|
|
117
118
|
)
|
|
118
119
|
|
|
119
120
|
|
|
@@ -144,6 +145,29 @@ except ApiError as e:
|
|
|
144
145
|
print(e.body)
|
|
145
146
|
```
|
|
146
147
|
|
|
148
|
+
## Pagination
|
|
149
|
+
|
|
150
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from speechify import Speechify
|
|
154
|
+
|
|
155
|
+
client = Speechify(
|
|
156
|
+
token="<token>",
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
client.voices.list()
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
# You can also iterate through pages and access the typed response per page
|
|
164
|
+
pager = client.voices.list(...)
|
|
165
|
+
for page in pager.iter_pages():
|
|
166
|
+
print(page.response) # access the typed response for each page
|
|
167
|
+
for item in page:
|
|
168
|
+
print(item)
|
|
169
|
+
```
|
|
170
|
+
|
|
147
171
|
## Advanced
|
|
148
172
|
|
|
149
173
|
### Access Raw Response Data
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Speechify Python Library
|
|
2
2
|
|
|
3
3
|
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fspeechifyinc%2Fspeechify-api-sdk-python)
|
|
4
4
|
[](https://pypi.python.org/pypi/speechify-api)
|
|
5
5
|
|
|
6
|
-
The
|
|
6
|
+
The Speechify Python library provides convenient access to the Speechify APIs from Python.
|
|
7
7
|
|
|
8
8
|
## Table of Contents
|
|
9
9
|
|
|
@@ -14,6 +14,7 @@ The Speechifyinc Python library provides convenient access to the Speechifyinc A
|
|
|
14
14
|
- [Environments](#environments)
|
|
15
15
|
- [Async Client](#async-client)
|
|
16
16
|
- [Exception Handling](#exception-handling)
|
|
17
|
+
- [Pagination](#pagination)
|
|
17
18
|
- [Advanced](#advanced)
|
|
18
19
|
- [Access Raw Response Data](#access-raw-response-data)
|
|
19
20
|
- [Retries](#retries)
|
|
@@ -43,7 +44,7 @@ Instantiate and use the client with the following:
|
|
|
43
44
|
from speechify import Speechify
|
|
44
45
|
|
|
45
46
|
client = Speechify(
|
|
46
|
-
|
|
47
|
+
token="<token>",
|
|
47
48
|
)
|
|
48
49
|
|
|
49
50
|
client.audio.speech(
|
|
@@ -77,7 +78,7 @@ import asyncio
|
|
|
77
78
|
from speechify import AsyncSpeechify
|
|
78
79
|
|
|
79
80
|
client = AsyncSpeechify(
|
|
80
|
-
|
|
81
|
+
token="<token>",
|
|
81
82
|
)
|
|
82
83
|
|
|
83
84
|
|
|
@@ -108,6 +109,29 @@ except ApiError as e:
|
|
|
108
109
|
print(e.body)
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
## Pagination
|
|
113
|
+
|
|
114
|
+
Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from speechify import Speechify
|
|
118
|
+
|
|
119
|
+
client = Speechify(
|
|
120
|
+
token="<token>",
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
client.voices.list()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# You can also iterate through pages and access the typed response per page
|
|
128
|
+
pager = client.voices.list(...)
|
|
129
|
+
for page in pager.iter_pages():
|
|
130
|
+
print(page.response) # access the typed response for each page
|
|
131
|
+
for item in page:
|
|
132
|
+
print(item)
|
|
133
|
+
```
|
|
134
|
+
|
|
111
135
|
## Advanced
|
|
112
136
|
|
|
113
137
|
### Access Raw Response Data
|
|
@@ -7,12 +7,8 @@ from importlib import import_module
|
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
9
|
from .types import (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
CreateVoiceModelName,
|
|
13
|
-
CreatedVoice,
|
|
14
|
-
CreatedVoiceGender,
|
|
15
|
-
CreatedVoiceType,
|
|
10
|
+
AudioOutputFormat,
|
|
11
|
+
AudioStreamOutputFormat,
|
|
16
12
|
Error,
|
|
17
13
|
ErrorCode,
|
|
18
14
|
ErrorDetail,
|
|
@@ -26,12 +22,15 @@ if typing.TYPE_CHECKING:
|
|
|
26
22
|
GetVoiceType,
|
|
27
23
|
GetVoicesModel,
|
|
28
24
|
GetVoicesModelName,
|
|
25
|
+
ListVoicesResponse,
|
|
29
26
|
NestedChunk,
|
|
27
|
+
PaginationMeta,
|
|
30
28
|
SpeechMarks,
|
|
31
29
|
)
|
|
32
30
|
from .errors import (
|
|
33
31
|
BadGatewayError,
|
|
34
32
|
BadRequestError,
|
|
33
|
+
ConflictError,
|
|
35
34
|
ForbiddenError,
|
|
36
35
|
InternalServerError,
|
|
37
36
|
NotFoundError,
|
|
@@ -55,15 +54,12 @@ if typing.TYPE_CHECKING:
|
|
|
55
54
|
from .voices import CreateVoicesRequestGender
|
|
56
55
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
57
56
|
"AsyncSpeechify": ".client",
|
|
57
|
+
"AudioOutputFormat": ".types",
|
|
58
|
+
"AudioStreamOutputFormat": ".types",
|
|
58
59
|
"BadGatewayError": ".errors",
|
|
59
60
|
"BadRequestError": ".errors",
|
|
60
|
-
"
|
|
61
|
-
"CreateVoiceModel": ".types",
|
|
62
|
-
"CreateVoiceModelName": ".types",
|
|
61
|
+
"ConflictError": ".errors",
|
|
63
62
|
"CreateVoicesRequestGender": ".voices",
|
|
64
|
-
"CreatedVoice": ".types",
|
|
65
|
-
"CreatedVoiceGender": ".types",
|
|
66
|
-
"CreatedVoiceType": ".types",
|
|
67
63
|
"DefaultAioHttpClient": "._default_clients",
|
|
68
64
|
"DefaultAsyncHttpxClient": "._default_clients",
|
|
69
65
|
"Error": ".types",
|
|
@@ -84,8 +80,10 @@ _dynamic_imports: typing.Dict[str, str] = {
|
|
|
84
80
|
"GetVoicesModel": ".types",
|
|
85
81
|
"GetVoicesModelName": ".types",
|
|
86
82
|
"InternalServerError": ".errors",
|
|
83
|
+
"ListVoicesResponse": ".types",
|
|
87
84
|
"NestedChunk": ".types",
|
|
88
85
|
"NotFoundError": ".errors",
|
|
86
|
+
"PaginationMeta": ".types",
|
|
89
87
|
"PaymentRequiredError": ".errors",
|
|
90
88
|
"ServiceUnavailableError": ".errors",
|
|
91
89
|
"SpeechMarks": ".types",
|
|
@@ -124,15 +122,12 @@ def __dir__():
|
|
|
124
122
|
|
|
125
123
|
__all__ = [
|
|
126
124
|
"AsyncSpeechify",
|
|
125
|
+
"AudioOutputFormat",
|
|
126
|
+
"AudioStreamOutputFormat",
|
|
127
127
|
"BadGatewayError",
|
|
128
128
|
"BadRequestError",
|
|
129
|
-
"
|
|
130
|
-
"CreateVoiceModel",
|
|
131
|
-
"CreateVoiceModelName",
|
|
129
|
+
"ConflictError",
|
|
132
130
|
"CreateVoicesRequestGender",
|
|
133
|
-
"CreatedVoice",
|
|
134
|
-
"CreatedVoiceGender",
|
|
135
|
-
"CreatedVoiceType",
|
|
136
131
|
"DefaultAioHttpClient",
|
|
137
132
|
"DefaultAsyncHttpxClient",
|
|
138
133
|
"Error",
|
|
@@ -153,8 +148,10 @@ __all__ = [
|
|
|
153
148
|
"GetVoicesModel",
|
|
154
149
|
"GetVoicesModelName",
|
|
155
150
|
"InternalServerError",
|
|
151
|
+
"ListVoicesResponse",
|
|
156
152
|
"NestedChunk",
|
|
157
153
|
"NotFoundError",
|
|
154
|
+
"PaginationMeta",
|
|
158
155
|
"PaymentRequiredError",
|
|
159
156
|
"ServiceUnavailableError",
|
|
160
157
|
"SpeechMarks",
|
|
@@ -4,6 +4,8 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.audio_output_format import AudioOutputFormat
|
|
8
|
+
from ..types.audio_stream_output_format import AudioStreamOutputFormat
|
|
7
9
|
from ..types.get_speech_options_request import GetSpeechOptionsRequest
|
|
8
10
|
from ..types.get_speech_response import GetSpeechResponse
|
|
9
11
|
from ..types.get_stream_options_request import GetStreamOptionsRequest
|
|
@@ -41,12 +43,15 @@ class AudioClient:
|
|
|
41
43
|
language: typing.Optional[str] = OMIT,
|
|
42
44
|
model: typing.Optional[GetSpeechRequestModel] = OMIT,
|
|
43
45
|
options: typing.Optional[GetSpeechOptionsRequest] = OMIT,
|
|
46
|
+
output_format: typing.Optional[AudioOutputFormat] = OMIT,
|
|
44
47
|
request_options: typing.Optional[RequestOptions] = None,
|
|
45
48
|
) -> GetSpeechResponse:
|
|
46
49
|
"""
|
|
47
50
|
Synthesize speech audio from text or SSML. Returns the complete audio
|
|
48
51
|
file plus billing and speech-mark metadata in a single JSON response.
|
|
49
52
|
For low-latency playback or long-form text, use POST /v1/audio/stream.
|
|
53
|
+
Set `output_format` for explicit sample-rate/bitrate control (e.g.
|
|
54
|
+
`pcm_16000` or `ulaw_8000` for telephony).
|
|
50
55
|
|
|
51
56
|
Parameters
|
|
52
57
|
----------
|
|
@@ -66,10 +71,13 @@ class AudioClient:
|
|
|
66
71
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
67
72
|
|
|
68
73
|
model : typing.Optional[GetSpeechRequestModel]
|
|
69
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
74
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.2` is the streaming-native model with lower TTFB and richer expressivity, and the recommended Simba 3 model. `simba-3.0` is the earlier Simba 3.0 model, still available. `simba-3.0` and `simba-3.2` are currently English only; multilingual coming soon, and non-English voices return 400 until it ships.
|
|
70
75
|
|
|
71
76
|
options : typing.Optional[GetSpeechOptionsRequest]
|
|
72
77
|
|
|
78
|
+
output_format : typing.Optional[AudioOutputFormat]
|
|
79
|
+
The output audio format as a `codec_sampleRate_bitrate` string. Takes precedence over `audio_format` when set.
|
|
80
|
+
|
|
73
81
|
request_options : typing.Optional[RequestOptions]
|
|
74
82
|
Request-specific configuration.
|
|
75
83
|
|
|
@@ -83,7 +91,8 @@ class AudioClient:
|
|
|
83
91
|
from speechify import Speechify
|
|
84
92
|
|
|
85
93
|
client = Speechify(
|
|
86
|
-
|
|
94
|
+
"2026-07-07",
|
|
95
|
+
token="YOUR_TOKEN",
|
|
87
96
|
)
|
|
88
97
|
client.audio.speech(
|
|
89
98
|
audio_format="mp3",
|
|
@@ -99,6 +108,7 @@ class AudioClient:
|
|
|
99
108
|
language=language,
|
|
100
109
|
model=model,
|
|
101
110
|
options=options,
|
|
111
|
+
output_format=output_format,
|
|
102
112
|
request_options=request_options,
|
|
103
113
|
)
|
|
104
114
|
return _response.data
|
|
@@ -106,29 +116,26 @@ class AudioClient:
|
|
|
106
116
|
def stream(
|
|
107
117
|
self,
|
|
108
118
|
*,
|
|
109
|
-
accept: StreamAudioRequestAccept,
|
|
110
119
|
input: str,
|
|
111
120
|
voice_id: str,
|
|
121
|
+
accept: typing.Optional[StreamAudioRequestAccept] = None,
|
|
112
122
|
language: typing.Optional[str] = OMIT,
|
|
113
123
|
model: typing.Optional[GetStreamRequestModel] = OMIT,
|
|
114
124
|
options: typing.Optional[GetStreamOptionsRequest] = OMIT,
|
|
125
|
+
output_format: typing.Optional[AudioStreamOutputFormat] = OMIT,
|
|
115
126
|
request_options: typing.Optional[RequestOptions] = None,
|
|
116
127
|
) -> typing.Iterator[bytes]:
|
|
117
128
|
"""
|
|
118
129
|
Synthesize speech and stream the audio back as it is generated, for
|
|
119
|
-
low-latency playback.
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
low-latency playback. Set `output_format` in the body for explicit
|
|
131
|
+
codec/sample-rate/bitrate control (e.g. `pcm_16000` or `ulaw_8000` for
|
|
132
|
+
telephony), or fall back to the Accept header for the container; the
|
|
133
|
+
response is raw audio bytes (HTTP chunked). For Base64-encoded audio
|
|
134
|
+
with speech-mark metadata in a single JSON response, use
|
|
122
135
|
POST /v1/audio/speech.
|
|
123
136
|
|
|
124
137
|
Parameters
|
|
125
138
|
----------
|
|
126
|
-
accept : StreamAudioRequestAccept
|
|
127
|
-
Selects the audio container/codec for the streamed response. The
|
|
128
|
-
response Content-Type echoes this value, except `audio/pcm` returns
|
|
129
|
-
`audio/L16` with rate and channels parameters (raw 16-bit linear
|
|
130
|
-
PCM, 24 kHz mono, little-endian).
|
|
131
|
-
|
|
132
139
|
input : str
|
|
133
140
|
Plain text or SSML to be synthesized to speech.
|
|
134
141
|
Refer to https://docs.speechify.ai/docs/api-limits for the input size limits.
|
|
@@ -137,43 +144,60 @@ class AudioClient:
|
|
|
137
144
|
voice_id : str
|
|
138
145
|
Id of the voice to be used for synthesizing speech. Refer to /v1/voices endpoint for available voices
|
|
139
146
|
|
|
147
|
+
accept : typing.Optional[StreamAudioRequestAccept]
|
|
148
|
+
Selects the audio container/codec for the streamed response when
|
|
149
|
+
`output_format` is not set in the request body. The response
|
|
150
|
+
Content-Type echoes this value, except `audio/pcm` returns
|
|
151
|
+
`audio/L16` with rate and channels parameters (raw 16-bit linear
|
|
152
|
+
PCM, 24 kHz mono, little-endian). For explicit sample-rate/bitrate
|
|
153
|
+
control (e.g. `pcm_16000`, `ulaw_8000`), set `output_format` in the
|
|
154
|
+
body instead; it takes precedence over this header.
|
|
155
|
+
|
|
140
156
|
language : typing.Optional[str]
|
|
141
157
|
Language of the input. Follow the format of an ISO 639-1 language code and an ISO 3166-1 region code, separated by a hyphen, e.g. en-US.
|
|
142
158
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
143
159
|
|
|
144
160
|
model : typing.Optional[GetStreamRequestModel]
|
|
145
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
161
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.2` is the streaming-native model with lower TTFB and richer expressivity, and the recommended Simba 3 model. `simba-3.0` is the earlier Simba 3.0 model, still available. `simba-3.0` and `simba-3.2` are currently English only; multilingual coming soon, and non-English voices return 400 until it ships.
|
|
146
162
|
|
|
147
163
|
options : typing.Optional[GetStreamOptionsRequest]
|
|
148
164
|
|
|
165
|
+
output_format : typing.Optional[AudioStreamOutputFormat]
|
|
166
|
+
The output audio format as a `codec_sampleRate_bitrate` string. Takes precedence over the `Accept` header when set, so you can request formats the `Accept` enum does not cover (e.g. `pcm_16000`, `ulaw_8000`). `wav_*` formats are not supported on streaming - use `POST /v1/audio/speech` for wav.
|
|
167
|
+
|
|
149
168
|
request_options : typing.Optional[RequestOptions]
|
|
150
169
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
151
170
|
|
|
152
171
|
Returns
|
|
153
172
|
-------
|
|
154
173
|
typing.Iterator[bytes]
|
|
155
|
-
|
|
174
|
+
Streamed audio. When `output_format` is set it selects the
|
|
175
|
+
codec/sample rate; otherwise the Accept header does. The
|
|
176
|
+
Content-Type reflects the selected format: it matches the Accept
|
|
177
|
+
header, except raw PCM returns `audio/L16` (with rate and channels
|
|
178
|
+
parameters) and u-law returns `audio/basic`.
|
|
156
179
|
|
|
157
180
|
Examples
|
|
158
181
|
--------
|
|
159
182
|
from speechify import Speechify
|
|
160
183
|
|
|
161
184
|
client = Speechify(
|
|
162
|
-
|
|
185
|
+
"2026-07-07",
|
|
186
|
+
token="YOUR_TOKEN",
|
|
163
187
|
)
|
|
164
188
|
client.audio.stream(
|
|
165
|
-
accept="audio/mpeg",
|
|
166
189
|
input="input",
|
|
167
190
|
voice_id="voice_id",
|
|
168
191
|
)
|
|
169
192
|
"""
|
|
170
193
|
with self._raw_client.stream(
|
|
171
|
-
accept=accept,
|
|
172
194
|
input=input,
|
|
173
195
|
voice_id=voice_id,
|
|
196
|
+
accept=accept,
|
|
174
197
|
language=language,
|
|
175
198
|
model=model,
|
|
176
199
|
options=options,
|
|
200
|
+
output_format=output_format,
|
|
177
201
|
request_options=request_options,
|
|
178
202
|
) as r:
|
|
179
203
|
yield from r.data
|
|
@@ -203,12 +227,15 @@ class AsyncAudioClient:
|
|
|
203
227
|
language: typing.Optional[str] = OMIT,
|
|
204
228
|
model: typing.Optional[GetSpeechRequestModel] = OMIT,
|
|
205
229
|
options: typing.Optional[GetSpeechOptionsRequest] = OMIT,
|
|
230
|
+
output_format: typing.Optional[AudioOutputFormat] = OMIT,
|
|
206
231
|
request_options: typing.Optional[RequestOptions] = None,
|
|
207
232
|
) -> GetSpeechResponse:
|
|
208
233
|
"""
|
|
209
234
|
Synthesize speech audio from text or SSML. Returns the complete audio
|
|
210
235
|
file plus billing and speech-mark metadata in a single JSON response.
|
|
211
236
|
For low-latency playback or long-form text, use POST /v1/audio/stream.
|
|
237
|
+
Set `output_format` for explicit sample-rate/bitrate control (e.g.
|
|
238
|
+
`pcm_16000` or `ulaw_8000` for telephony).
|
|
212
239
|
|
|
213
240
|
Parameters
|
|
214
241
|
----------
|
|
@@ -228,10 +255,13 @@ class AsyncAudioClient:
|
|
|
228
255
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
229
256
|
|
|
230
257
|
model : typing.Optional[GetSpeechRequestModel]
|
|
231
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
258
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.2` is the streaming-native model with lower TTFB and richer expressivity, and the recommended Simba 3 model. `simba-3.0` is the earlier Simba 3.0 model, still available. `simba-3.0` and `simba-3.2` are currently English only; multilingual coming soon, and non-English voices return 400 until it ships.
|
|
232
259
|
|
|
233
260
|
options : typing.Optional[GetSpeechOptionsRequest]
|
|
234
261
|
|
|
262
|
+
output_format : typing.Optional[AudioOutputFormat]
|
|
263
|
+
The output audio format as a `codec_sampleRate_bitrate` string. Takes precedence over `audio_format` when set.
|
|
264
|
+
|
|
235
265
|
request_options : typing.Optional[RequestOptions]
|
|
236
266
|
Request-specific configuration.
|
|
237
267
|
|
|
@@ -247,7 +277,8 @@ class AsyncAudioClient:
|
|
|
247
277
|
from speechify import AsyncSpeechify
|
|
248
278
|
|
|
249
279
|
client = AsyncSpeechify(
|
|
250
|
-
|
|
280
|
+
"2026-07-07",
|
|
281
|
+
token="YOUR_TOKEN",
|
|
251
282
|
)
|
|
252
283
|
|
|
253
284
|
|
|
@@ -269,6 +300,7 @@ class AsyncAudioClient:
|
|
|
269
300
|
language=language,
|
|
270
301
|
model=model,
|
|
271
302
|
options=options,
|
|
303
|
+
output_format=output_format,
|
|
272
304
|
request_options=request_options,
|
|
273
305
|
)
|
|
274
306
|
return _response.data
|
|
@@ -276,29 +308,26 @@ class AsyncAudioClient:
|
|
|
276
308
|
async def stream(
|
|
277
309
|
self,
|
|
278
310
|
*,
|
|
279
|
-
accept: StreamAudioRequestAccept,
|
|
280
311
|
input: str,
|
|
281
312
|
voice_id: str,
|
|
313
|
+
accept: typing.Optional[StreamAudioRequestAccept] = None,
|
|
282
314
|
language: typing.Optional[str] = OMIT,
|
|
283
315
|
model: typing.Optional[GetStreamRequestModel] = OMIT,
|
|
284
316
|
options: typing.Optional[GetStreamOptionsRequest] = OMIT,
|
|
317
|
+
output_format: typing.Optional[AudioStreamOutputFormat] = OMIT,
|
|
285
318
|
request_options: typing.Optional[RequestOptions] = None,
|
|
286
319
|
) -> typing.AsyncIterator[bytes]:
|
|
287
320
|
"""
|
|
288
321
|
Synthesize speech and stream the audio back as it is generated, for
|
|
289
|
-
low-latency playback.
|
|
290
|
-
|
|
291
|
-
|
|
322
|
+
low-latency playback. Set `output_format` in the body for explicit
|
|
323
|
+
codec/sample-rate/bitrate control (e.g. `pcm_16000` or `ulaw_8000` for
|
|
324
|
+
telephony), or fall back to the Accept header for the container; the
|
|
325
|
+
response is raw audio bytes (HTTP chunked). For Base64-encoded audio
|
|
326
|
+
with speech-mark metadata in a single JSON response, use
|
|
292
327
|
POST /v1/audio/speech.
|
|
293
328
|
|
|
294
329
|
Parameters
|
|
295
330
|
----------
|
|
296
|
-
accept : StreamAudioRequestAccept
|
|
297
|
-
Selects the audio container/codec for the streamed response. The
|
|
298
|
-
response Content-Type echoes this value, except `audio/pcm` returns
|
|
299
|
-
`audio/L16` with rate and channels parameters (raw 16-bit linear
|
|
300
|
-
PCM, 24 kHz mono, little-endian).
|
|
301
|
-
|
|
302
331
|
input : str
|
|
303
332
|
Plain text or SSML to be synthesized to speech.
|
|
304
333
|
Refer to https://docs.speechify.ai/docs/api-limits for the input size limits.
|
|
@@ -307,22 +336,38 @@ class AsyncAudioClient:
|
|
|
307
336
|
voice_id : str
|
|
308
337
|
Id of the voice to be used for synthesizing speech. Refer to /v1/voices endpoint for available voices
|
|
309
338
|
|
|
339
|
+
accept : typing.Optional[StreamAudioRequestAccept]
|
|
340
|
+
Selects the audio container/codec for the streamed response when
|
|
341
|
+
`output_format` is not set in the request body. The response
|
|
342
|
+
Content-Type echoes this value, except `audio/pcm` returns
|
|
343
|
+
`audio/L16` with rate and channels parameters (raw 16-bit linear
|
|
344
|
+
PCM, 24 kHz mono, little-endian). For explicit sample-rate/bitrate
|
|
345
|
+
control (e.g. `pcm_16000`, `ulaw_8000`), set `output_format` in the
|
|
346
|
+
body instead; it takes precedence over this header.
|
|
347
|
+
|
|
310
348
|
language : typing.Optional[str]
|
|
311
349
|
Language of the input. Follow the format of an ISO 639-1 language code and an ISO 3166-1 region code, separated by a hyphen, e.g. en-US.
|
|
312
350
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
313
351
|
|
|
314
352
|
model : typing.Optional[GetStreamRequestModel]
|
|
315
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
353
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.2` is the streaming-native model with lower TTFB and richer expressivity, and the recommended Simba 3 model. `simba-3.0` is the earlier Simba 3.0 model, still available. `simba-3.0` and `simba-3.2` are currently English only; multilingual coming soon, and non-English voices return 400 until it ships.
|
|
316
354
|
|
|
317
355
|
options : typing.Optional[GetStreamOptionsRequest]
|
|
318
356
|
|
|
357
|
+
output_format : typing.Optional[AudioStreamOutputFormat]
|
|
358
|
+
The output audio format as a `codec_sampleRate_bitrate` string. Takes precedence over the `Accept` header when set, so you can request formats the `Accept` enum does not cover (e.g. `pcm_16000`, `ulaw_8000`). `wav_*` formats are not supported on streaming - use `POST /v1/audio/speech` for wav.
|
|
359
|
+
|
|
319
360
|
request_options : typing.Optional[RequestOptions]
|
|
320
361
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
321
362
|
|
|
322
363
|
Returns
|
|
323
364
|
-------
|
|
324
365
|
typing.AsyncIterator[bytes]
|
|
325
|
-
|
|
366
|
+
Streamed audio. When `output_format` is set it selects the
|
|
367
|
+
codec/sample rate; otherwise the Accept header does. The
|
|
368
|
+
Content-Type reflects the selected format: it matches the Accept
|
|
369
|
+
header, except raw PCM returns `audio/L16` (with rate and channels
|
|
370
|
+
parameters) and u-law returns `audio/basic`.
|
|
326
371
|
|
|
327
372
|
Examples
|
|
328
373
|
--------
|
|
@@ -331,13 +376,13 @@ class AsyncAudioClient:
|
|
|
331
376
|
from speechify import AsyncSpeechify
|
|
332
377
|
|
|
333
378
|
client = AsyncSpeechify(
|
|
334
|
-
|
|
379
|
+
"2026-07-07",
|
|
380
|
+
token="YOUR_TOKEN",
|
|
335
381
|
)
|
|
336
382
|
|
|
337
383
|
|
|
338
384
|
async def main() -> None:
|
|
339
385
|
await client.audio.stream(
|
|
340
|
-
accept="audio/mpeg",
|
|
341
386
|
input="input",
|
|
342
387
|
voice_id="voice_id",
|
|
343
388
|
)
|
|
@@ -346,12 +391,13 @@ class AsyncAudioClient:
|
|
|
346
391
|
asyncio.run(main())
|
|
347
392
|
"""
|
|
348
393
|
async with self._raw_client.stream(
|
|
349
|
-
accept=accept,
|
|
350
394
|
input=input,
|
|
351
395
|
voice_id=voice_id,
|
|
396
|
+
accept=accept,
|
|
352
397
|
language=language,
|
|
353
398
|
model=model,
|
|
354
399
|
options=options,
|
|
400
|
+
output_format=output_format,
|
|
355
401
|
request_options=request_options,
|
|
356
402
|
) as r:
|
|
357
403
|
async for _chunk in r.data:
|