vocalstack 1.0.0__py3-none-any.whl
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.
- vocalstack/SKILL.md +243 -0
- vocalstack/__init__.py +61 -0
- vocalstack/_http.py +166 -0
- vocalstack/_models.py +2347 -0
- vocalstack/client.py +113 -0
- vocalstack/errors.py +97 -0
- vocalstack/realtime.py +555 -0
- vocalstack/resources.py +1277 -0
- vocalstack-1.0.0.dist-info/METADATA +124 -0
- vocalstack-1.0.0.dist-info/RECORD +12 -0
- vocalstack-1.0.0.dist-info/WHEEL +4 -0
- vocalstack-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: vocalstack
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: VocalStack speech API SDK (asyncio): one client grouped by resource, typed models from the API contract, realtime WebSocket streaming.
|
|
5
|
+
Project-URL: Homepage, https://vocalstack.com
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: httpx>=0.27
|
|
10
|
+
Requires-Dist: pydantic>=2.7
|
|
11
|
+
Requires-Dist: websockets>=13
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# vocalstack
|
|
15
|
+
|
|
16
|
+
The VocalStack speech API for Python (3.10 or newer, asyncio): one client,
|
|
17
|
+
`VocalStack`, with one group per resource. Requests go through `httpx`; answers
|
|
18
|
+
are pydantic models generated from the API's one OpenAPI document
|
|
19
|
+
(`/v1/openapi.json`), with snake_case attributes.
|
|
20
|
+
|
|
21
|
+
Read more about the [VocalStack Python SDK](https://vocalstack.com/#developers) and our other SDKs on the [VocalStack website](https://vocalstack.com/).
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
import asyncio, os
|
|
25
|
+
from vocalstack import VocalStack
|
|
26
|
+
|
|
27
|
+
async def main():
|
|
28
|
+
async with VocalStack(api_key=os.environ["VOCALSTACK_API_KEY"]) as vs: # base_url defaults to https://api.vocalstack.com
|
|
29
|
+
tx = await vs.transcriptions.create(url="https://example.com/talk.mp3") # or file="talk.mp3"
|
|
30
|
+
job = await vs.jobs.wait(tx.job.recording_id) # done | failed | cropping
|
|
31
|
+
snap = await vs.recordings.transcript(job.recording_id)
|
|
32
|
+
print(" ".join(s.text for s in snap.sentences))
|
|
33
|
+
open("talk.srt", "wb").write(await vs.recordings.export(job.recording_id, "srt"))
|
|
34
|
+
|
|
35
|
+
asyncio.run(main())
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
<!-- sdk-docs: generated from the VocalStack API guides; edits here are overwritten -->
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pip install vocalstack
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Guides
|
|
47
|
+
|
|
48
|
+
- [Quickstart](https://github.com/vocalstack/python-sdk/blob/main/docs/quickstart.md): An API key, the SDK, and your first transcript in a dozen lines.
|
|
49
|
+
- [Transcribe a file](https://github.com/vocalstack/python-sdk/blob/main/docs/transcribe-a-file.md): Upload a file, wait for its job, read the transcript and export it. Asynchronous; nothing to keep open.
|
|
50
|
+
- [Transcribe a link](https://github.com/vocalstack/python-sdk/blob/main/docs/transcribe-a-link.md): The server fetches a public URL, a YouTube video or a post on a video or audio site, then transcribes it like a file. Asynchronous, with a fetch phase first.
|
|
51
|
+
- [Search your transcriptions](https://github.com/vocalstack/python-sdk/blob/main/docs/search-transcriptions.md): Find transcriptions by words in their name or link, site, language, kind, tag and date, keep the shared ones, and play each with its share code.
|
|
52
|
+
- [Stream a microphone](https://github.com/vocalstack/python-sdk/blob/main/docs/stream-a-microphone.md): Live audio in, transcript events out, over one WebSocket. Drafts replace the live tail; commits append.
|
|
53
|
+
- [Stream a file at full speed](https://github.com/vocalstack/python-sdk/blob/main/docs/stream-a-file.md): Send a file's bytes through a realtime session and read the transcript as fast as the server makes it. Nothing is stored.
|
|
54
|
+
- [Go live](https://github.com/vocalstack/python-sdk/blob/main/docs/go-live.md): Publish live audio to a stored transcription, and put it on a broadcast link listeners open. Control is HTTP; audio is one WebSocket.
|
|
55
|
+
- [Listen](https://github.com/vocalstack/python-sdk/blob/main/docs/listen.md): Follow a transcription as it happens, in any language: subscribe, catch up from a snapshot, then apply live frames in order.
|
|
56
|
+
- [Live translation and spoken translations](https://github.com/vocalstack/python-sdk/blob/main/docs/translation-and-voices.md): Translate a stream as it is spoken, and have each translated sentence spoken back in a voice. Text frames and audio clips, over the same socket.
|
|
57
|
+
- [Connect an app with one click](https://github.com/vocalstack/python-sdk/blob/main/docs/connect-an-app.md): Let the people who use your app connect their VocalStack account with one Authenticate click — OAuth 2.0 authorization code with PKCE, where the access token is an API key — instead of pasting a key.
|
|
58
|
+
- [Errors, retries and limits](https://github.com/vocalstack/python-sdk/blob/main/docs/errors-and-limits.md): One error envelope everywhere; what to retry (429, 503 unavailable) and how to make a retry safe (Idempotency-Key); credit, plan limits and the 402s.
|
|
59
|
+
|
|
60
|
+
<!-- /sdk-docs -->
|
|
61
|
+
|
|
62
|
+
## What is what
|
|
63
|
+
|
|
64
|
+
| Name | What it is | Group |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| realtime session | a signed token plus one socket; nothing stored | `vs.realtime` |
|
|
67
|
+
| broadcast | the link listeners open | `vs.broadcasts` |
|
|
68
|
+
| transcription | a file, link, microphone or stream, transcribed and stored | `vs.transcriptions` |
|
|
69
|
+
| recording | one take inside a broadcast or a transcription | `vs.recordings` |
|
|
70
|
+
| job | a file or link recording's transcription work | `vs.jobs` |
|
|
71
|
+
|
|
72
|
+
The other groups: `vs.corrections`, `vs.share_links`, `vs.speakers`,
|
|
73
|
+
`vs.voices`, `vs.search`, `vs.me`, `vs.languages`, `vs.rtmp`, `vs.events`, `vs.meta`.
|
|
74
|
+
Method names are the document's `operationId`s in snake_case
|
|
75
|
+
(`broadcasts.start_recording` is `POST /v1/broadcasts/{id}/recordings`).
|
|
76
|
+
Request fields are keyword arguments, in snake_case or the wire's camelCase
|
|
77
|
+
(`settings={"spokenLanguage": "en"}`); lists return lists; binary answers
|
|
78
|
+
(`recordings.export`, `recordings.clip`, `speakers.sample`, ...) return bytes.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
VocalStack(
|
|
82
|
+
base_url=None, # default https://api.vocalstack.com
|
|
83
|
+
api_key=None, # an API key (vs_key_...), for a server
|
|
84
|
+
token=None, # or: an access token / browser token, or a callable returning one
|
|
85
|
+
acting_principal=None, # act for an organization (X-Acting-Principal)
|
|
86
|
+
device_id=None,
|
|
87
|
+
max_retries=2, # 429s, and 503 unavailable on safe calls, retried after Retry-After
|
|
88
|
+
timeout=300.0,
|
|
89
|
+
ready_deadline_s=30.0, # how long a socket may take to report ready
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Realtime sessions and live recordings
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
async with VocalStack(api_key=key) as vs:
|
|
97
|
+
# Nothing stored: a file through one socket.
|
|
98
|
+
result = await vs.realtime.transcribe_file("meeting.mp3", spoken_language="en")
|
|
99
|
+
print(result.text)
|
|
100
|
+
|
|
101
|
+
# A stored live transcription: start a recording, stream raw PCM
|
|
102
|
+
# (f32le, 16 kHz, mono) into the publisher socket.
|
|
103
|
+
tx = await vs.transcriptions.create_live(name="Standup")
|
|
104
|
+
grant = await vs.transcriptions.start_recording(tx.id)
|
|
105
|
+
async with await vs.recordings.publish(grant) as stream:
|
|
106
|
+
asyncio.create_task(pace_realtime(stream, pcm)) # then eof()
|
|
107
|
+
async for event in stream:
|
|
108
|
+
if event.type == "transcript.committed":
|
|
109
|
+
print(event.segment.speaker, event.segment.text)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- `transcript.draft` frames **fully replace** the live tail; never append them.
|
|
113
|
+
- `transcript.committed` segments are immutable, gapless by `segment.seq`,
|
|
114
|
+
and carry word timings.
|
|
115
|
+
- A dropped connection ends the socket (no resume): start a new one.
|
|
116
|
+
|
|
117
|
+
## Errors
|
|
118
|
+
|
|
119
|
+
`VocalStackError` carries `code` (the contract's closed enum), `message`,
|
|
120
|
+
`status`, `retryable`, `details` (quota numbers, code suggestions), `headers`
|
|
121
|
+
and `retry_after`.
|
|
122
|
+
|
|
123
|
+
Verified against a language-agnostic conformance suite shared by every
|
|
124
|
+
VocalStack SDK and against a running API. For agents: `SKILL.md`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
vocalstack/__init__.py,sha256=tLrnArTm7r6LDGuo31xFNdcIMwR1Hfk_G8t0CqaGjPk,1363
|
|
2
|
+
vocalstack/_http.py,sha256=dTNxWnMivCU0Hza-sILfpqqQ30XXAokME6nypew8NH4,6090
|
|
3
|
+
vocalstack/_models.py,sha256=Ki1iGK9svfL3k0X4HLyPTo0Ic1dAy3eahcD4P_YvqKc,81086
|
|
4
|
+
vocalstack/client.py,sha256=rAx_WUsvampHH_UBziyflO8q2VkIbErX9pXc2-YcFaE,3436
|
|
5
|
+
vocalstack/errors.py,sha256=7q76sYOg1FiC1v5Sx2xK1IprVohjuFHepDCggA7kRgk,3552
|
|
6
|
+
vocalstack/realtime.py,sha256=jZy9nD-3P4OJW7il2YwiR4MeVMNRSbWlIQA5lMZm4UE,22595
|
|
7
|
+
vocalstack/resources.py,sha256=TW0CooqVgSMocBqpX1DIav4eAITpzA2NhDfUFZYhzrU,62652
|
|
8
|
+
vocalstack/SKILL.md,sha256=0HYYBMh22o0nDzn-SCITdrzXPoMwIJpjWxt18b4PACE,12746
|
|
9
|
+
vocalstack-1.0.0.dist-info/METADATA,sha256=EK-iTAH-CXJro1zY2U4_PX9l8nAXd6AK2k7h7LdEM3M,7142
|
|
10
|
+
vocalstack-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
11
|
+
vocalstack-1.0.0.dist-info/licenses/LICENSE,sha256=8vAZoxE2F1x9QYh6wYVAQlnk4_lOf7NUugELmY_YW2Q,1067
|
|
12
|
+
vocalstack-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VocalStack
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|