Skip to main content

Python SDK for Verbum AI speech services (sync and async)

Project description

verbum-sdk (Python)

CI PyPI Python License: MIT

Python SDK for Verbum AI speech services — real-time speech-to-text and speech-to-speech streaming, translation, text analysis, text-to-speech, and batch transcription. Sync and async clients ship from a single package.

Install

pip install verbum-sdk

Quickstart — sync

from verbum import VerbumClient, VerbumClientOptions, SttConnectOptions, create_api_token

client = VerbumClient(VerbumClientOptions(
    api_token=create_api_token("sk-..."),
    base_url="wss://sdk.verbum.ai",
))

# Context manager — session.stop() is called automatically on exit
with client.stt.connect(SttConnectOptions(language=["en-US"], encoding="PCM")) as session:
    session.on_recognized(lambda result: print(result.text))
    session.stream(pcm_bytes)   # call repeatedly with PCM audio chunks
# session is stopped here

Or without the context manager:

session = client.stt.connect(SttConnectOptions(language=["en-US"], encoding="PCM"))
session.on_recognized(lambda result: print(result.text))
session.stream(pcm_bytes)
session.stop()

Quickstart — async

import asyncio
from verbum import AsyncVerbumClient, VerbumClientOptions, SttConnectOptions, create_api_token

async def main() -> None:
    client = AsyncVerbumClient(VerbumClientOptions(
        api_token=create_api_token("sk-..."),
        base_url="wss://sdk.verbum.ai",
    ))

    # Awaitable + async context manager — both patterns work
    async with client.stt.connect(SttConnectOptions(language=["en-US"], encoding="PCM")) as session:
        session.on_recognized(lambda result: print(result.text))
        await session.stream(pcm_bytes)

asyncio.run(main())

From a non-async context (e.g. an ML pipeline):

session = client.stt.connect_sync(SttConnectOptions(language=["en-US"], encoding="PCM"))
session.stream_sync(pcm_bytes)   # thread-safe, no event loop required
session.stop_sync()

Quickstart — REST resources

from verbum.rest.types import TranslateRequest, SingleText

# Translation
result = client.rest.translator.translate(
    TranslateRequest(texts=[SingleText("Hello, world!")], to=["es", "fr"])
)
print(result.translations)

# Batch transcription (shortcut via client.batch)
from verbum.rest.types import BatchTranscribeRequest
job = client.batch.create_batch_job(BatchTranscribeRequest(urls=["https://..."], language="en-US"))
status = client.batch.get_batch_job_status(job.transcription_id)
result = client.batch.get_batch_job_result(job.transcription_id)

# Usage / consumption (shortcut via client.usage)
from verbum.rest.types import ConsumptionQuery
records = client.usage.get_consumption(ConsumptionQuery(start_date="2026-01-01", end_date="2026-12-31"))

Jupyter notebook

A live microphone transcription demo is available at notebooks/realtime_transcription.ipynb.

pip install "verbum-sdk[notebooks]"
jupyter lab notebooks/realtime_transcription.ipynb

API docs

Full API reference generated by Sphinx:

pip install "verbum-sdk[docs]"
cd docs && make html
# open docs/_build/html/index.html

Project layout

src/verbum/
  client.py       VerbumClient / AsyncVerbumClient
  auth/           API token auth provider
  stt/            SttModule / SttSession (+ Async variants) — full implementation
  ws/             Socket.IO transport (VerbumWebSocket / AsyncVerbumWebSocket)
  rest/           REST resource clients — translator, text-analysis, speech/TTS,
                  scribe, usage; circuit-breaker + retry on the base client

This mirrors the reference TypeScript SDK (src/*.ts) module-for-module so the two implementations stay easy to diff against each other during development.

Protocol & conformance

This SDK speaks the wire protocol documented in specs/PROTOCOL.md (Engine.IO v4 over WebSocket, Socket.IO /listen and /repeat namespaces) and passes the shared conformance suite (TC-001–TC-006) as a mandatory CI gate.

specs/ is a git submodule of verbum-sdk-specs; after cloning, run:

git submodule update --init --recursive

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

ruff check .                        # lint
ruff format --check .               # format check
mypy                                # type check
pytest                              # unit tests (≥90 % coverage enforced)
pytest tests/integration/ -v        # integration tests (requires VERBUM_SDK_TEST_API_KEY)

Run the conformance suite locally (requires Node ≥ 22 + pnpm ≥ 11):

cd specs/conformance/runner && pnpm install && pnpm build && cd ../../..
VERBUM_SDK_API_KEY=<key> node specs/conformance/runner/dist/index.js run \
  --adapter "python tests/conformance/adapter.py" \
  --suite specs/conformance/suite \
  --specs-root specs

Project status

Area Status
Packaging / tooling Done
verbum.auth Done
verbum.stt session state machine Done
verbum.ws Socket.IO transport Done
verbum.rest.* (translator, text-analysis, speech, scribe, usage) Done
verbum.rest.* (users, projects, invitations, metrics — manager-api) Not planned
Unit tests (≥90 % coverage) Done
Integration tests Done
Conformance suite (TC-001–TC-006) Done
Sphinx API docs Done
Jupyter quickstart notebook Done
PyPI publish (CI/CD) Done

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

verbum_sdk-1.0.4.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

verbum_sdk-1.0.4-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file verbum_sdk-1.0.4.tar.gz.

File metadata

  • Download URL: verbum_sdk-1.0.4.tar.gz
  • Upload date:
  • Size: 61.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for verbum_sdk-1.0.4.tar.gz
Algorithm Hash digest
SHA256 5af6dca3bc48665df9d1ec14e4d68df09a20164a5ceaac270ea25d08dc0dcef5
MD5 68ad9a787db1a2dc6a2172bf94aa6ae3
BLAKE2b-256 8883d9e6f972c1b333f14d756ce5a0119b8238e17efad76b5152d661a831750f

See more details on using hashes here.

Provenance

The following attestation bundles were made for verbum_sdk-1.0.4.tar.gz:

Publisher: ci.yml on getstandup/verbum-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file verbum_sdk-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: verbum_sdk-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 36.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for verbum_sdk-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1b568bbefc20d132af604b34eec0a59a202138b09737435441d1e728c8bdbbb0
MD5 b6e9da1aeb4f80997fed0bf744099dc4
BLAKE2b-256 c1aac6e48b26c30a0e24ec0cb51b297361ababaafd48eed287e396b69b769bee

See more details on using hashes here.

Provenance

The following attestation bundles were made for verbum_sdk-1.0.4-py3-none-any.whl:

Publisher: ci.yml on getstandup/verbum-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page