ThunderPhone Python SDK
Python 3.10+. Install pip install thunderphone. Set THUNDERPHONE_API_KEY in your
environment, or pass api_key= to ThunderPhone. Optional base_url defaults to
https://api.thunderphone.com (do not append /v1).
import os
from thunderphone import ThunderPhone, AgentRequest, PlaceCallRequest
with ThunderPhone() as api:
agent = api.agents.create(AgentRequest(
name="Reception",
prompt="Help callers with scheduling and business information.",
voice=os.environ["THUNDERPHONE_VOICE"],
))
call = api.calls.place(PlaceCallRequest(
agent_id=agent.id,
from_number=os.environ["FROM_NUMBER"],
to_number=os.environ["TO_NUMBER"],
idempotency_key="appointment-123",
))
done = api.calls.wait_for_completion(
call.call_id, timeout=300, poll_interval=1,
)
if done.status == "failed":
raise RuntimeError(done.end_reason)
print(api.calls.transcript(call.call_id).transcripts)
Choose a voice from GET /v1/voices. Outbound calls require an outbound-capable
carrier number, sufficient balance, and the organization's outbound confirmation.
Polling returns both completed and failed calls. A polling deadline raises
TimeoutError; HTTP timeouts and transport errors propagate. Writes are never
retried automatically. Reuse an idempotency key only for the same request.
Every operation has generated synchronous and asynchronous functions and typed
request/response models under thunderphone.generated. For example:
from thunderphone.generated.api.calls import calls_list
with ThunderPhone() as api:
page = calls_list.sync(client=api.client, limit=20, offset=0)
Generated functions offer sync, sync_detailed, asyncio, and asyncio_detailed
where the operation has a response body. Detailed variants retain status and headers;
undocumented errors return parsed=None unless raise_on_unexpected_status is enabled
on the generated client. Helpers raise ThunderPhoneError with status and body.
The client sends X-ThunderPhone-Client: sdk-python/0.2.0. Use a context manager or
close() for the facade; close generated async clients with their async context manager.
Verify webhook and tool-call signatures
Every request ThunderPhone sends to your server carries
X-ThunderPhone-Signature-V2, a timestamped HMAC over the method, path, query and
raw body. verify_signature checks it and rejects requests older than five minutes:
from thunderphone import verify_signature
ok = verify_signature(
request.headers.get("X-ThunderPhone-Signature-V2"),
secret=os.environ["THUNDERPHONE_WEBHOOK_SECRET"], # or a list while rotating
method=request.method,
path="/thunderphone-webhook?source=prod", # path and query exactly as received
body=raw_body, # the raw bytes, before any JSON parsing
)
tolerance= changes the 300-second window. compute_signature builds a signature
for your own tests. The module uses only the standard library. See
Verify webhook signatures.
Development: pip install -e ., python -m unittest discover -s tests -v,
python -m build. Regenerate from the repository root using
scripts/generate-sdks.sh; never edit thunderphone/generated/ by hand.
Metadata
Release files for thunderphone 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thunderphone-0.2.0.tar.gz | 296.8 kB | With provenance | Details for thunderphone-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thunderphone-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for thunderphone-0.2.0-py3-none-any.whl |
Total release size: 1.2 MB
Release files / thunderphone-0.2.0.tar.gz
| Download URL | thunderphone-0.2.0.tar.gz |
|---|---|
| Size | 296.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376f278e2cf54af22db291854830cfac386fb5ca8acf909ef2a3b2e22e9a010b
|
|
BLAKE2b-256 checksum How to use checksums |
231a6b97e5851a6f08d0dd5802d3840eb46533dcdddd8f14b07d605172d2b3e0
|
| 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 Oct 1, 2026.
Transparency logRelease files / thunderphone-0.2.0-py3-none-any.whl
| Download URL | thunderphone-0.2.0-py3-none-any.whl |
|---|---|
| Size | 911.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9f1f52f740de99802d5cb0a812611f3fdc31226c9154fa941838a5022603e77
|
|
BLAKE2b-256 checksum How to use checksums |
02617500c835b377aa720485ad833b80e357d27d3f41a5f84cfd6b476501826b
|
| 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 Oct 1, 2026.
Transparency logSecurity for thunderphone 0.2.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for thunderphone-0.2.0.tar.gz
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 Oct 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.