Skip to main content

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

sw = SpeechWeave()

job = sw.jobs.create(
	file="./podcast.mp3",
	model="core",
	service_mode="deferred",
)

done = wait_for_job(sw, job["id"])
print(done["transcript"])

jobs.create accepts a local path string or an open binary file. For URL input, cancel, and other job operations, see the API reference.

Translation & formatted transcripts

Translate audio to English text, or fetch a completed job's transcript formatted as text, srt, vtt, or verbose_json (word/segment timestamps):

from speechweave import SpeechWeave, wait_for_job

sw = SpeechWeave()

job = sw.jobs.create(file="./spanish_podcast.mp3", task="translate")
done = wait_for_job(sw, job["id"])
print(done["transcript"])  # English text, regardless of the source language

# Once a job has completed, fetch its transcript in another format
srt = sw.get_job_formatted(job["id"], format="srt")

Handling buffers & streams

When you already have an open file handle or in-memory bytes, use transcribe_file directly:

from speechweave import SpeechWeave, wait_for_job

sw = SpeechWeave()

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

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

Async

import asyncio
from speechweave import AsyncSpeechWeave, async_wait_for_job

async def main():
	async with AsyncSpeechWeave() as sw:
		job = await sw.jobs.create(
			file="./podcast.mp3",
			model="core",
			service_mode="deferred",
		)

		done = await async_wait_for_job(sw, job["id"])
		print(done["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)
	print(e.error_type)  # OpenAI-style category, e.g. "insufficient_quota"
	# Prepaid wallet / spend caps: HTTP 402 with codes like INSUFFICIENT_BALANCE,
	# WALLET_EMPTY, USER_SPEND_CAP_REACHED, CHECKOUT_REQUIRED, PLATFORM_SPEND_CAP_REACHED.
	if e.status == 402 and e.code == "PLATFORM_SPEND_CAP_REACHED":
		print("Monthly account limit reached; do not retry until next month.")
	elif e.status == 402:
		print("Top up the wallet or raise spend caps, then retry.")
	# HTTP 403 with code EMAIL_UNVERIFIED: the account owning this API key hasn't
	# verified its email yet. Verify it, then retry; the key itself is still valid.
	elif e.status == 403 and e.code == "EMAIL_UNVERIFIED":
		print("Verify the account email before uploading or creating jobs.")

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"])

Uploads go straight to storage the same way jobs.create does, so this supports files up to the same 250 MB self-serve limit.

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)

client.audio.translations.create(model="core", file=f) works the same way for translating audio into English text; OpenAI's translations endpoint has no language parameter, the source language is always auto-detected.

Upload size: this path posts through the same wire format as the official OpenAI client, so it's capped at 90 MB per file to stay under standard upload limits. For anything larger, switch to client.audio.transcriptions.create(...) from this SDK's drop-in helpers above: same call shape, and it unlocks the full 250 MB limit because uploads go straight to storage instead.

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

Release files for speechweave 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for speechweave 1.7.1
File Size Uploaded
speechweave-1.7.1.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for speechweave 1.7.1
File Interpreter ABI Platform
speechweave-1.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.0 kB

Release files / speechweave-1.7.1.tar.gz

Download URL speechweave-1.7.1.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e412ec97181405e59dffbdbfbc856fe60c0880d1700aeb6533bc74c03b6d5c1c
BLAKE2b-256 checksum
How to use checksums
211aa27f9f14194edee1f84d62cfcab104fa4c6123bff256c38c88944e455563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / speechweave-1.7.1-py3-none-any.whl

Download URL speechweave-1.7.1-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db4cde4443dafc3ba01702f6fba366975501881078046b6715385c3d9ad5c64a
BLAKE2b-256 checksum
How to use checksums
16e2e80d3df6fb4dacbb2ab4f922bd5c08a9d02a4d1fccb495bfcacefeaa088f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

1.7.2

2 release files

This release

1.7.1 This release

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page