Official SpeechWeave Python SDK
Project description
SpeechWeave Python SDK
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.
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)
# Prepaid wallet / spend caps: HTTP 402 with codes like INSUFFICIENT_BALANCE,
# WALLET_EMPTY, SPEND_CAP_REACHED, CHECKOUT_REQUIRED.
if e.status == 402:
print("Top up the wallet or raise spend caps, then retry.")
Configuration
api_key— or setSPEECHWEAVE_API_KEYbase_url— defaults tohttps://api.speechweave.com/v1timeout— httpx timeout in seconds (default120)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speechweave-1.0.2.tar.gz.
File metadata
- Download URL: speechweave-1.0.2.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d627c76bb4227402a6acb8ff2acc8828f6c994a46e2b8f16ec32d37cdbb6808
|
|
| MD5 |
11a4d50c049345aabda63354fdd59a02
|
|
| BLAKE2b-256 |
06fb31607e8c8c7229161d96c048b191a452a2cab9f16de29fc99dd58c86c65f
|
Provenance
The following attestation bundles were made for speechweave-1.0.2.tar.gz:
Publisher:
publish.yml on speechweave/speechweave-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechweave-1.0.2.tar.gz -
Subject digest:
0d627c76bb4227402a6acb8ff2acc8828f6c994a46e2b8f16ec32d37cdbb6808 - Sigstore transparency entry: 2147389147
- Sigstore integration time:
-
Permalink:
speechweave/speechweave-python@61ca98015adc0e8aba6d07830cc679500384401d -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/speechweave
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@61ca98015adc0e8aba6d07830cc679500384401d -
Trigger Event:
push
-
Statement type:
File details
Details for the file speechweave-1.0.2-py3-none-any.whl.
File metadata
- Download URL: speechweave-1.0.2-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f77380756118f4f4ddeff62b4d204d7aae0420fb2d53a18bf5eb184dd12f4868
|
|
| MD5 |
bf9dcf10396e1beb6b0e5e77aa882180
|
|
| BLAKE2b-256 |
710d7e46d5071d0a9f7c04acf096a0bdea18ef2dc37a4d9739f3200f8a1e141d
|
Provenance
The following attestation bundles were made for speechweave-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on speechweave/speechweave-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechweave-1.0.2-py3-none-any.whl -
Subject digest:
f77380756118f4f4ddeff62b4d204d7aae0420fb2d53a18bf5eb184dd12f4868 - Sigstore transparency entry: 2147389492
- Sigstore integration time:
-
Permalink:
speechweave/speechweave-python@61ca98015adc0e8aba6d07830cc679500384401d -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/speechweave
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@61ca98015adc0e8aba6d07830cc679500384401d -
Trigger Event:
push
-
Statement type: