speechify-api 2.0.1__tar.gz → 2.0.2__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.1 → speechify_api-2.0.2}/PKG-INFO +5 -29
- {speechify_api-2.0.1 → speechify_api-2.0.2}/README.md +4 -28
- {speechify_api-2.0.1 → speechify_api-2.0.2}/pyproject.toml +2 -2
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/__init__.py +18 -15
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/client.py +34 -80
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/raw_client.py +26 -70
- speechify_api-2.0.2/src/speechify/audio/types/get_speech_request_model.py +5 -0
- speechify_api-2.0.2/src/speechify/audio/types/get_stream_request_model.py +5 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/client.py +12 -20
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/__init__.py +0 -5
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/client_wrapper.py +13 -21
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/__init__.py +0 -3
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/__init__.py +18 -12
- speechify_api-2.0.2/src/speechify/types/create_voice_language.py +20 -0
- speechify_api-2.0.2/src/speechify/types/create_voice_model.py +22 -0
- speechify_api-2.0.2/src/speechify/types/create_voice_model_name.py +5 -0
- speechify_api-2.0.2/src/speechify/types/created_voice.py +28 -0
- speechify_api-2.0.2/src/speechify/types/created_voice_gender.py +5 -0
- speechify_api-2.0.2/src/speechify/types/created_voice_type.py +5 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/error_code.py +0 -11
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/error_detail.py +0 -10
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_speech_response.py +1 -7
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_speech_response_audio_format.py +1 -1
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_voice_gender.py +1 -1
- speechify_api-2.0.2/src/speechify/types/get_voices_model_name.py +5 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/voices/client.py +45 -197
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/voices/raw_client.py +40 -413
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/voices/types/create_voices_request_gender.py +1 -1
- speechify_api-2.0.1/src/speechify/audio/types/get_speech_request_model.py +0 -7
- speechify_api-2.0.1/src/speechify/audio/types/get_stream_request_model.py +0 -7
- speechify_api-2.0.1/src/speechify/core/pagination.py +0 -82
- speechify_api-2.0.1/src/speechify/errors/conflict_error.py +0 -10
- speechify_api-2.0.1/src/speechify/types/audio_output_format.py +0 -30
- speechify_api-2.0.1/src/speechify/types/audio_stream_output_format.py +0 -28
- speechify_api-2.0.1/src/speechify/types/get_voices_model_name.py +0 -7
- speechify_api-2.0.1/src/speechify/types/list_voices_response.py +0 -29
- speechify_api-2.0.1/src/speechify/types/pagination_meta.py +0 -36
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/_default_clients.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/__init__.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/types/__init__.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/types/get_speech_request_audio_format.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/audio/types/stream_audio_request_accept.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/api_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/datetime_utils.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/file.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/force_multipart.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_client.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_response.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_sse/__init__.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_sse/_api.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_sse/_decoders.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_sse/_exceptions.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/http_sse/_models.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/jsonable_encoder.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/logging.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/parse_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/pydantic_utilities.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/query_encoder.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/remove_none_from_dict.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/request_options.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/core/serialization.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/environment.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/bad_gateway_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/bad_request_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/forbidden_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/internal_server_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/not_found_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/payment_required_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/service_unavailable_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/too_many_requests_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/unauthorized_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/errors/unprocessable_entity_error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/py.typed +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/error.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_speech_options_request.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_stream_options_request.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_voice.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_voice_language.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_voice_type.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/get_voices_model.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/nested_chunk.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/types/speech_marks.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/version.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/voices/__init__.py +0 -0
- {speechify_api-2.0.1 → speechify_api-2.0.2}/src/speechify/voices/types/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: speechify-api
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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
|
+
# Speechifyinc 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 Speechifyinc Python library provides convenient access to the Speechifyinc APIs from Python.
|
|
43
43
|
|
|
44
44
|
## Table of Contents
|
|
45
45
|
|
|
@@ -50,7 +50,6 @@ The Speechify Python library provides convenient access to the Speechify APIs fr
|
|
|
50
50
|
- [Environments](#environments)
|
|
51
51
|
- [Async Client](#async-client)
|
|
52
52
|
- [Exception Handling](#exception-handling)
|
|
53
|
-
- [Pagination](#pagination)
|
|
54
53
|
- [Advanced](#advanced)
|
|
55
54
|
- [Access Raw Response Data](#access-raw-response-data)
|
|
56
55
|
- [Retries](#retries)
|
|
@@ -80,7 +79,7 @@ Instantiate and use the client with the following:
|
|
|
80
79
|
from speechify import Speechify
|
|
81
80
|
|
|
82
81
|
client = Speechify(
|
|
83
|
-
|
|
82
|
+
api_key="<token>",
|
|
84
83
|
)
|
|
85
84
|
|
|
86
85
|
client.audio.speech(
|
|
@@ -114,7 +113,7 @@ import asyncio
|
|
|
114
113
|
from speechify import AsyncSpeechify
|
|
115
114
|
|
|
116
115
|
client = AsyncSpeechify(
|
|
117
|
-
|
|
116
|
+
api_key="<token>",
|
|
118
117
|
)
|
|
119
118
|
|
|
120
119
|
|
|
@@ -145,29 +144,6 @@ except ApiError as e:
|
|
|
145
144
|
print(e.body)
|
|
146
145
|
```
|
|
147
146
|
|
|
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
|
-
|
|
171
147
|
## Advanced
|
|
172
148
|
|
|
173
149
|
### Access Raw Response Data
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Speechifyinc 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 Speechifyinc Python library provides convenient access to the Speechifyinc APIs from Python.
|
|
7
7
|
|
|
8
8
|
## Table of Contents
|
|
9
9
|
|
|
@@ -14,7 +14,6 @@ The Speechify Python library provides convenient access to the Speechify APIs fr
|
|
|
14
14
|
- [Environments](#environments)
|
|
15
15
|
- [Async Client](#async-client)
|
|
16
16
|
- [Exception Handling](#exception-handling)
|
|
17
|
-
- [Pagination](#pagination)
|
|
18
17
|
- [Advanced](#advanced)
|
|
19
18
|
- [Access Raw Response Data](#access-raw-response-data)
|
|
20
19
|
- [Retries](#retries)
|
|
@@ -44,7 +43,7 @@ Instantiate and use the client with the following:
|
|
|
44
43
|
from speechify import Speechify
|
|
45
44
|
|
|
46
45
|
client = Speechify(
|
|
47
|
-
|
|
46
|
+
api_key="<token>",
|
|
48
47
|
)
|
|
49
48
|
|
|
50
49
|
client.audio.speech(
|
|
@@ -78,7 +77,7 @@ import asyncio
|
|
|
78
77
|
from speechify import AsyncSpeechify
|
|
79
78
|
|
|
80
79
|
client = AsyncSpeechify(
|
|
81
|
-
|
|
80
|
+
api_key="<token>",
|
|
82
81
|
)
|
|
83
82
|
|
|
84
83
|
|
|
@@ -109,29 +108,6 @@ except ApiError as e:
|
|
|
109
108
|
print(e.body)
|
|
110
109
|
```
|
|
111
110
|
|
|
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
|
-
|
|
135
111
|
## Advanced
|
|
136
112
|
|
|
137
113
|
### Access Raw Response Data
|
|
@@ -7,8 +7,12 @@ from importlib import import_module
|
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
9
|
from .types import (
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
CreateVoiceLanguage,
|
|
11
|
+
CreateVoiceModel,
|
|
12
|
+
CreateVoiceModelName,
|
|
13
|
+
CreatedVoice,
|
|
14
|
+
CreatedVoiceGender,
|
|
15
|
+
CreatedVoiceType,
|
|
12
16
|
Error,
|
|
13
17
|
ErrorCode,
|
|
14
18
|
ErrorDetail,
|
|
@@ -22,15 +26,12 @@ if typing.TYPE_CHECKING:
|
|
|
22
26
|
GetVoiceType,
|
|
23
27
|
GetVoicesModel,
|
|
24
28
|
GetVoicesModelName,
|
|
25
|
-
ListVoicesResponse,
|
|
26
29
|
NestedChunk,
|
|
27
|
-
PaginationMeta,
|
|
28
30
|
SpeechMarks,
|
|
29
31
|
)
|
|
30
32
|
from .errors import (
|
|
31
33
|
BadGatewayError,
|
|
32
34
|
BadRequestError,
|
|
33
|
-
ConflictError,
|
|
34
35
|
ForbiddenError,
|
|
35
36
|
InternalServerError,
|
|
36
37
|
NotFoundError,
|
|
@@ -54,12 +55,15 @@ if typing.TYPE_CHECKING:
|
|
|
54
55
|
from .voices import CreateVoicesRequestGender
|
|
55
56
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
56
57
|
"AsyncSpeechify": ".client",
|
|
57
|
-
"AudioOutputFormat": ".types",
|
|
58
|
-
"AudioStreamOutputFormat": ".types",
|
|
59
58
|
"BadGatewayError": ".errors",
|
|
60
59
|
"BadRequestError": ".errors",
|
|
61
|
-
"
|
|
60
|
+
"CreateVoiceLanguage": ".types",
|
|
61
|
+
"CreateVoiceModel": ".types",
|
|
62
|
+
"CreateVoiceModelName": ".types",
|
|
62
63
|
"CreateVoicesRequestGender": ".voices",
|
|
64
|
+
"CreatedVoice": ".types",
|
|
65
|
+
"CreatedVoiceGender": ".types",
|
|
66
|
+
"CreatedVoiceType": ".types",
|
|
63
67
|
"DefaultAioHttpClient": "._default_clients",
|
|
64
68
|
"DefaultAsyncHttpxClient": "._default_clients",
|
|
65
69
|
"Error": ".types",
|
|
@@ -80,10 +84,8 @@ _dynamic_imports: typing.Dict[str, str] = {
|
|
|
80
84
|
"GetVoicesModel": ".types",
|
|
81
85
|
"GetVoicesModelName": ".types",
|
|
82
86
|
"InternalServerError": ".errors",
|
|
83
|
-
"ListVoicesResponse": ".types",
|
|
84
87
|
"NestedChunk": ".types",
|
|
85
88
|
"NotFoundError": ".errors",
|
|
86
|
-
"PaginationMeta": ".types",
|
|
87
89
|
"PaymentRequiredError": ".errors",
|
|
88
90
|
"ServiceUnavailableError": ".errors",
|
|
89
91
|
"SpeechMarks": ".types",
|
|
@@ -122,12 +124,15 @@ def __dir__():
|
|
|
122
124
|
|
|
123
125
|
__all__ = [
|
|
124
126
|
"AsyncSpeechify",
|
|
125
|
-
"AudioOutputFormat",
|
|
126
|
-
"AudioStreamOutputFormat",
|
|
127
127
|
"BadGatewayError",
|
|
128
128
|
"BadRequestError",
|
|
129
|
-
"
|
|
129
|
+
"CreateVoiceLanguage",
|
|
130
|
+
"CreateVoiceModel",
|
|
131
|
+
"CreateVoiceModelName",
|
|
130
132
|
"CreateVoicesRequestGender",
|
|
133
|
+
"CreatedVoice",
|
|
134
|
+
"CreatedVoiceGender",
|
|
135
|
+
"CreatedVoiceType",
|
|
131
136
|
"DefaultAioHttpClient",
|
|
132
137
|
"DefaultAsyncHttpxClient",
|
|
133
138
|
"Error",
|
|
@@ -148,10 +153,8 @@ __all__ = [
|
|
|
148
153
|
"GetVoicesModel",
|
|
149
154
|
"GetVoicesModelName",
|
|
150
155
|
"InternalServerError",
|
|
151
|
-
"ListVoicesResponse",
|
|
152
156
|
"NestedChunk",
|
|
153
157
|
"NotFoundError",
|
|
154
|
-
"PaginationMeta",
|
|
155
158
|
"PaymentRequiredError",
|
|
156
159
|
"ServiceUnavailableError",
|
|
157
160
|
"SpeechMarks",
|
|
@@ -4,8 +4,6 @@ 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
|
|
9
7
|
from ..types.get_speech_options_request import GetSpeechOptionsRequest
|
|
10
8
|
from ..types.get_speech_response import GetSpeechResponse
|
|
11
9
|
from ..types.get_stream_options_request import GetStreamOptionsRequest
|
|
@@ -43,15 +41,12 @@ class AudioClient:
|
|
|
43
41
|
language: typing.Optional[str] = OMIT,
|
|
44
42
|
model: typing.Optional[GetSpeechRequestModel] = OMIT,
|
|
45
43
|
options: typing.Optional[GetSpeechOptionsRequest] = OMIT,
|
|
46
|
-
output_format: typing.Optional[AudioOutputFormat] = OMIT,
|
|
47
44
|
request_options: typing.Optional[RequestOptions] = None,
|
|
48
45
|
) -> GetSpeechResponse:
|
|
49
46
|
"""
|
|
50
47
|
Synthesize speech audio from text or SSML. Returns the complete audio
|
|
51
48
|
file plus billing and speech-mark metadata in a single JSON response.
|
|
52
49
|
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).
|
|
55
50
|
|
|
56
51
|
Parameters
|
|
57
52
|
----------
|
|
@@ -71,13 +66,10 @@ class AudioClient:
|
|
|
71
66
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
72
67
|
|
|
73
68
|
model : typing.Optional[GetSpeechRequestModel]
|
|
74
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
69
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.0` is the streaming-native model with lower TTFB and richer expressivity. Currently English only; multilingual coming soon. Non-English voices return 400 until multilingual support ships.
|
|
75
70
|
|
|
76
71
|
options : typing.Optional[GetSpeechOptionsRequest]
|
|
77
72
|
|
|
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
|
-
|
|
81
73
|
request_options : typing.Optional[RequestOptions]
|
|
82
74
|
Request-specific configuration.
|
|
83
75
|
|
|
@@ -91,8 +83,7 @@ class AudioClient:
|
|
|
91
83
|
from speechify import Speechify
|
|
92
84
|
|
|
93
85
|
client = Speechify(
|
|
94
|
-
"
|
|
95
|
-
token="YOUR_TOKEN",
|
|
86
|
+
api_key="YOUR_API_KEY",
|
|
96
87
|
)
|
|
97
88
|
client.audio.speech(
|
|
98
89
|
audio_format="mp3",
|
|
@@ -108,7 +99,6 @@ class AudioClient:
|
|
|
108
99
|
language=language,
|
|
109
100
|
model=model,
|
|
110
101
|
options=options,
|
|
111
|
-
output_format=output_format,
|
|
112
102
|
request_options=request_options,
|
|
113
103
|
)
|
|
114
104
|
return _response.data
|
|
@@ -116,26 +106,29 @@ class AudioClient:
|
|
|
116
106
|
def stream(
|
|
117
107
|
self,
|
|
118
108
|
*,
|
|
109
|
+
accept: StreamAudioRequestAccept,
|
|
119
110
|
input: str,
|
|
120
111
|
voice_id: str,
|
|
121
|
-
accept: typing.Optional[StreamAudioRequestAccept] = None,
|
|
122
112
|
language: typing.Optional[str] = OMIT,
|
|
123
113
|
model: typing.Optional[GetStreamRequestModel] = OMIT,
|
|
124
114
|
options: typing.Optional[GetStreamOptionsRequest] = OMIT,
|
|
125
|
-
output_format: typing.Optional[AudioStreamOutputFormat] = OMIT,
|
|
126
115
|
request_options: typing.Optional[RequestOptions] = None,
|
|
127
116
|
) -> typing.Iterator[bytes]:
|
|
128
117
|
"""
|
|
129
118
|
Synthesize speech and stream the audio back as it is generated, for
|
|
130
|
-
low-latency playback.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
response is raw audio bytes (HTTP chunked). For Base64-encoded audio
|
|
134
|
-
with speech-mark metadata in a single JSON response, use
|
|
119
|
+
low-latency playback. The Accept header selects the audio container;
|
|
120
|
+
the response is raw audio bytes (HTTP chunked). For Base64-encoded
|
|
121
|
+
audio with speech-mark metadata in a single JSON response, use
|
|
135
122
|
POST /v1/audio/speech.
|
|
136
123
|
|
|
137
124
|
Parameters
|
|
138
125
|
----------
|
|
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
|
+
|
|
139
132
|
input : str
|
|
140
133
|
Plain text or SSML to be synthesized to speech.
|
|
141
134
|
Refer to https://docs.speechify.ai/docs/api-limits for the input size limits.
|
|
@@ -144,60 +137,43 @@ class AudioClient:
|
|
|
144
137
|
voice_id : str
|
|
145
138
|
Id of the voice to be used for synthesizing speech. Refer to /v1/voices endpoint for available voices
|
|
146
139
|
|
|
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
|
-
|
|
156
140
|
language : typing.Optional[str]
|
|
157
141
|
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.
|
|
158
142
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
159
143
|
|
|
160
144
|
model : typing.Optional[GetStreamRequestModel]
|
|
161
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
145
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.0` is the streaming-native model with lower TTFB and richer expressivity. Currently English only; multilingual coming soon. Non-English voices return 400 until multilingual support ships.
|
|
162
146
|
|
|
163
147
|
options : typing.Optional[GetStreamOptionsRequest]
|
|
164
148
|
|
|
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
|
-
|
|
168
149
|
request_options : typing.Optional[RequestOptions]
|
|
169
150
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
170
151
|
|
|
171
152
|
Returns
|
|
172
153
|
-------
|
|
173
154
|
typing.Iterator[bytes]
|
|
174
|
-
|
|
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`.
|
|
155
|
+
Chunked audio stream for the requested input.
|
|
179
156
|
|
|
180
157
|
Examples
|
|
181
158
|
--------
|
|
182
159
|
from speechify import Speechify
|
|
183
160
|
|
|
184
161
|
client = Speechify(
|
|
185
|
-
"
|
|
186
|
-
token="YOUR_TOKEN",
|
|
162
|
+
api_key="YOUR_API_KEY",
|
|
187
163
|
)
|
|
188
164
|
client.audio.stream(
|
|
165
|
+
accept="audio/mpeg",
|
|
189
166
|
input="input",
|
|
190
167
|
voice_id="voice_id",
|
|
191
168
|
)
|
|
192
169
|
"""
|
|
193
170
|
with self._raw_client.stream(
|
|
171
|
+
accept=accept,
|
|
194
172
|
input=input,
|
|
195
173
|
voice_id=voice_id,
|
|
196
|
-
accept=accept,
|
|
197
174
|
language=language,
|
|
198
175
|
model=model,
|
|
199
176
|
options=options,
|
|
200
|
-
output_format=output_format,
|
|
201
177
|
request_options=request_options,
|
|
202
178
|
) as r:
|
|
203
179
|
yield from r.data
|
|
@@ -227,15 +203,12 @@ class AsyncAudioClient:
|
|
|
227
203
|
language: typing.Optional[str] = OMIT,
|
|
228
204
|
model: typing.Optional[GetSpeechRequestModel] = OMIT,
|
|
229
205
|
options: typing.Optional[GetSpeechOptionsRequest] = OMIT,
|
|
230
|
-
output_format: typing.Optional[AudioOutputFormat] = OMIT,
|
|
231
206
|
request_options: typing.Optional[RequestOptions] = None,
|
|
232
207
|
) -> GetSpeechResponse:
|
|
233
208
|
"""
|
|
234
209
|
Synthesize speech audio from text or SSML. Returns the complete audio
|
|
235
210
|
file plus billing and speech-mark metadata in a single JSON response.
|
|
236
211
|
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).
|
|
239
212
|
|
|
240
213
|
Parameters
|
|
241
214
|
----------
|
|
@@ -255,13 +228,10 @@ class AsyncAudioClient:
|
|
|
255
228
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
256
229
|
|
|
257
230
|
model : typing.Optional[GetSpeechRequestModel]
|
|
258
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
231
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.0` is the streaming-native model with lower TTFB and richer expressivity. Currently English only; multilingual coming soon. Non-English voices return 400 until multilingual support ships.
|
|
259
232
|
|
|
260
233
|
options : typing.Optional[GetSpeechOptionsRequest]
|
|
261
234
|
|
|
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
|
-
|
|
265
235
|
request_options : typing.Optional[RequestOptions]
|
|
266
236
|
Request-specific configuration.
|
|
267
237
|
|
|
@@ -277,8 +247,7 @@ class AsyncAudioClient:
|
|
|
277
247
|
from speechify import AsyncSpeechify
|
|
278
248
|
|
|
279
249
|
client = AsyncSpeechify(
|
|
280
|
-
"
|
|
281
|
-
token="YOUR_TOKEN",
|
|
250
|
+
api_key="YOUR_API_KEY",
|
|
282
251
|
)
|
|
283
252
|
|
|
284
253
|
|
|
@@ -300,7 +269,6 @@ class AsyncAudioClient:
|
|
|
300
269
|
language=language,
|
|
301
270
|
model=model,
|
|
302
271
|
options=options,
|
|
303
|
-
output_format=output_format,
|
|
304
272
|
request_options=request_options,
|
|
305
273
|
)
|
|
306
274
|
return _response.data
|
|
@@ -308,26 +276,29 @@ class AsyncAudioClient:
|
|
|
308
276
|
async def stream(
|
|
309
277
|
self,
|
|
310
278
|
*,
|
|
279
|
+
accept: StreamAudioRequestAccept,
|
|
311
280
|
input: str,
|
|
312
281
|
voice_id: str,
|
|
313
|
-
accept: typing.Optional[StreamAudioRequestAccept] = None,
|
|
314
282
|
language: typing.Optional[str] = OMIT,
|
|
315
283
|
model: typing.Optional[GetStreamRequestModel] = OMIT,
|
|
316
284
|
options: typing.Optional[GetStreamOptionsRequest] = OMIT,
|
|
317
|
-
output_format: typing.Optional[AudioStreamOutputFormat] = OMIT,
|
|
318
285
|
request_options: typing.Optional[RequestOptions] = None,
|
|
319
286
|
) -> typing.AsyncIterator[bytes]:
|
|
320
287
|
"""
|
|
321
288
|
Synthesize speech and stream the audio back as it is generated, for
|
|
322
|
-
low-latency playback.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
response is raw audio bytes (HTTP chunked). For Base64-encoded audio
|
|
326
|
-
with speech-mark metadata in a single JSON response, use
|
|
289
|
+
low-latency playback. The Accept header selects the audio container;
|
|
290
|
+
the response is raw audio bytes (HTTP chunked). For Base64-encoded
|
|
291
|
+
audio with speech-mark metadata in a single JSON response, use
|
|
327
292
|
POST /v1/audio/speech.
|
|
328
293
|
|
|
329
294
|
Parameters
|
|
330
295
|
----------
|
|
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
|
+
|
|
331
302
|
input : str
|
|
332
303
|
Plain text or SSML to be synthesized to speech.
|
|
333
304
|
Refer to https://docs.speechify.ai/docs/api-limits for the input size limits.
|
|
@@ -336,38 +307,22 @@ class AsyncAudioClient:
|
|
|
336
307
|
voice_id : str
|
|
337
308
|
Id of the voice to be used for synthesizing speech. Refer to /v1/voices endpoint for available voices
|
|
338
309
|
|
|
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
|
-
|
|
348
310
|
language : typing.Optional[str]
|
|
349
311
|
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.
|
|
350
312
|
Please refer to the list of the supported languages and recommendations regarding this parameter: https://docs.speechify.ai/docs/language-support.
|
|
351
313
|
|
|
352
314
|
model : typing.Optional[GetStreamRequestModel]
|
|
353
|
-
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.
|
|
315
|
+
Model used for audio synthesis. `simba-english` is optimized for English, `simba-multilingual` for non-English or mixed input. `simba-3.0` is the streaming-native model with lower TTFB and richer expressivity. Currently English only; multilingual coming soon. Non-English voices return 400 until multilingual support ships.
|
|
354
316
|
|
|
355
317
|
options : typing.Optional[GetStreamOptionsRequest]
|
|
356
318
|
|
|
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
|
-
|
|
360
319
|
request_options : typing.Optional[RequestOptions]
|
|
361
320
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
362
321
|
|
|
363
322
|
Returns
|
|
364
323
|
-------
|
|
365
324
|
typing.AsyncIterator[bytes]
|
|
366
|
-
|
|
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`.
|
|
325
|
+
Chunked audio stream for the requested input.
|
|
371
326
|
|
|
372
327
|
Examples
|
|
373
328
|
--------
|
|
@@ -376,13 +331,13 @@ class AsyncAudioClient:
|
|
|
376
331
|
from speechify import AsyncSpeechify
|
|
377
332
|
|
|
378
333
|
client = AsyncSpeechify(
|
|
379
|
-
"
|
|
380
|
-
token="YOUR_TOKEN",
|
|
334
|
+
api_key="YOUR_API_KEY",
|
|
381
335
|
)
|
|
382
336
|
|
|
383
337
|
|
|
384
338
|
async def main() -> None:
|
|
385
339
|
await client.audio.stream(
|
|
340
|
+
accept="audio/mpeg",
|
|
386
341
|
input="input",
|
|
387
342
|
voice_id="voice_id",
|
|
388
343
|
)
|
|
@@ -391,13 +346,12 @@ class AsyncAudioClient:
|
|
|
391
346
|
asyncio.run(main())
|
|
392
347
|
"""
|
|
393
348
|
async with self._raw_client.stream(
|
|
349
|
+
accept=accept,
|
|
394
350
|
input=input,
|
|
395
351
|
voice_id=voice_id,
|
|
396
|
-
accept=accept,
|
|
397
352
|
language=language,
|
|
398
353
|
model=model,
|
|
399
354
|
options=options,
|
|
400
|
-
output_format=output_format,
|
|
401
355
|
request_options=request_options,
|
|
402
356
|
) as r:
|
|
403
357
|
async for _chunk in r.data:
|