Skip to main content

Official SpeechWeave Python SDK

Project description

SpeechWeave Python SDK

PyPI version Python versions License: MIT

The native Python SDK for SpeechWeave — background job polling, presigned uploads, and webhook verification. Python 3.10+.

Docs: speechweave.com/docs · API reference

Install

pip install speechweave

Set your API key:

export SPEECHWEAVE_API_KEY="sk_..."

Quick start

from speechweave import SpeechWeave, wait_for_job

client = SpeechWeave()

with open("audio.wav", "rb") as f:
	job = client.transcribe_file(
		f,
		filename="audio.wav",
		model="core",
		language="en",
	)

result = wait_for_job(client, job["id"], timeout_sec=300)
print(result["transcript"])

For jobs.create, URL input, cancel, and other job operations, see the API reference.

Async

import asyncio
from speechweave import AsyncSpeechWeave, async_wait_for_job

async def main():
	async with AsyncSpeechWeave() as client:
		with open("audio.wav", "rb") as f:
			job = await client.transcribe_file(
				f,
				filename="audio.wav",
				model="core",
			)

		result = await async_wait_for_job(client, job["id"])
		print(result["transcript"])

asyncio.run(main())

Webhooks

from speechweave import verify_webhook

result = verify_webhook(
	secret=WEBHOOK_SECRET,
	raw_body=raw_body,
	signature_header=signature_header,
)

See the docs for a full FastAPI example.

Errors

from speechweave import SpeechWeave, SpeechWeaveError

try:
	client = SpeechWeave(api_key="bad_key")
	client.get_job("job_123")
except SpeechWeaveError as e:
	print(e.status)
	print(e.code)

Configuration

  • api_key — or set SPEECHWEAVE_API_KEY
  • base_url — defaults to https://api.speechweave.com/v1
  • timeout — httpx timeout in seconds (default 120)

Compatibility & Migration

If you are building a new application, use the native SDK above for full feature support. If you have an existing OpenAI, Deepgram, or AssemblyAI codebase, use the options below to switch with minimal changes.

Drop-in usage

Convenience helpers if you want OpenAI/Deepgram/AssemblyAI response shapes without adding another package. They use presigned uploads like the native API.

from speechweave import SpeechWeave

client = SpeechWeave()

with open("clip.mp3", "rb") as f:
	result = client.audio.transcriptions.create(
		file=f,
		filename="clip.mp3",
		model="core",
	)

print(result["text"])

More examples: OpenAI · Deepgram · AssemblyAI

Migrating from OpenAI

You don't need this SDK for a quick swap — use the official openai package and point it at SpeechWeave:

from openai import OpenAI

client = OpenAI(
    api_key="sk_live_...",
    base_url="https://api.speechweave.com/v1",
)

with open("clip.mp3", "rb") as f:
    result = client.audio.transcriptions.create(model="core", file=f)

print(result.text)

OpenAI model names like whisper-1 are aliased to core on our backend. See the OpenAI migration guide.

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

speechweave-1.0.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

speechweave-1.0.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file speechweave-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for speechweave-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e16e720578ffbb5bbd7a568e150cf0fe8a15889f90dbf7c34a5843cc5160665e
MD5 7db03a8305015f8d84618c31f3aa401d
BLAKE2b-256 13454d55ffaca02a371a8ef59a629425b4dd4f151f8103c54355a7a4a3e4511e

See more details on using hashes here.

Provenance

The following attestation bundles were made for speechweave-1.0.0.tar.gz:

Publisher: publish.yml on speechweave/speechweave-python

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

File details

Details for the file speechweave-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for speechweave-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aba75ef42a3dd8aa8f7d8d031854ac6017777b8b4ae62727a9d3a16efe27924c
MD5 fc0ff00f7f174e915e904df08277d525
BLAKE2b-256 f75aee882ff9a8115d96564fe34dc7264216a0b5b1bd83466e30a9683095d6d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for speechweave-1.0.0-py3-none-any.whl:

Publisher: publish.yml on speechweave/speechweave-python

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