Skip to main content

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.1.0. Use a context manager or close() for the facade; close generated async clients with their async context manager.

API reference · OpenAPI

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.

Release files for thunderphone 0.1.0

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

Source distribution (sdist)

Source distribution for thunderphone 0.1.0
File Size Uploaded
thunderphone-0.1.0.tar.gz 237.8 kB Details

Built distribution (wheel)

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

Total release size: 1.0 MB

Release files / thunderphone-0.1.0.tar.gz

Download URL thunderphone-0.1.0.tar.gz
Size 237.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2c1c45c999e8b617e1c2f4c0496ff70b3aa5bc148ded26f185d8c4550f37039d
BLAKE2b-256 checksum
How to use checksums
2fe8cd1eddc9faf1d0d1e9f1d3debcc461ea93d733e9435ea1b3e847d631126e
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 19, 2026.

Transparency log

Release files / thunderphone-0.1.0-py3-none-any.whl

Download URL thunderphone-0.1.0-py3-none-any.whl
Size 766.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5051541693e62646aa29202a77ee1632d9be4d663466468b217100e2710dcb5e
BLAKE2b-256 checksum
How to use checksums
b9c9e7ac48cba50c440891f7c5590332937923ad31620aa887d2372bb8871554
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 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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