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.2.tar.gz (59.5 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.2-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: verbum_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 59.5 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.2.tar.gz
Algorithm Hash digest
SHA256 93284f87419fdae93fc72ffdc6c8bfe58f35a4534005460d83d25026d6c9352d
MD5 b6881fe9f59b233d9d6ba5e39aa4fd69
BLAKE2b-256 a458ee89cc01750fc9935865ccb31b2bb135507ba7087f399329d23d0575c818

See more details on using hashes here.

Provenance

The following attestation bundles were made for verbum_sdk-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: verbum_sdk-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 35.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 accd7770933d573e663eaed724f6cea897f403980312de53c43305f0df5893b8
MD5 6aebdc7f211d062eb5882bd1b8da6401
BLAKE2b-256 87d30b49c024729e4c2f0662448ae06ddff7dca9e334ea852739d2038f214fff

See more details on using hashes here.

Provenance

The following attestation bundles were made for verbum_sdk-1.0.2-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