ThankYou Python SDK
Official Python SDK for the ThankYou unified creative generation API.
pip install thankyouai
Create a Client
from thankyou import ThankYou
thankyou = ThankYou(api_key="tk_...")
The default base URL is https://api.thankyouai.com/open/v1.
Text to Image
result = await thankyou.run(
model="flux/v2/pro/text-to-image",
input={
"prompt": "A mountain landscape at golden hour",
"aspect_ratio": "16:9",
},
)
print(result.output[0]["url"])
Image to Video with an Uploaded File
file = await thankyou.files.upload(file="./photo.jpg")
generation = await thankyou.generations.create(
model="wan/v2.6/image-to-video",
input={
"prompt": "Gentle camera movement with soft evening light",
"reference_assets": [{"url": file.url}],
},
)
result = await thankyou.generations.wait(
generation.id,
interval=3.0,
timeout=10 * 60,
)
Quote Before Execute
Use a quote when you want to estimate the cost and check whether a request can run before starting the generation. A quote returns the resolved input, estimated cost, blocking reasons, and an expiration time.
quote = await thankyou.generations.quote(
model="wan/v2.6/text-to-video",
input={"prompt": "A koi fish swimming", "duration": 5},
)
if quote.blocking_reasons:
raise RuntimeError(", ".join(quote.blocking_reasons))
print(quote.estimated_cost, quote.currency, quote.expires_at)
generation = await thankyou.generations.create(quote_id=quote.quote_id)
Models
models = await thankyou.models.list()
detail = await thankyou.models.detail("wan/v2.6/text-to-video")
print(len(models.models))
print(detail.input_schema)
Model IDs can contain /, so models.detail() calls GET /models/detail?model_id=....
Webhook Verification
event = thankyou.webhooks.verify(
raw_body=raw_body,
signature=request.headers["x-thankyou-signature"],
timestamp=request.headers["x-thankyou-timestamp"],
secret="whsec_...",
)
if event.event == "generation.completed":
print(event.generation.output[0]["url"] if event.generation else None)
The signature is HMAC-SHA256 over {timestamp}.{raw_body} and is formatted as sha256=<hex>.
Error Handling
from thankyou import (
ThankYouAPIError,
ThankYouAuthenticationError,
ThankYouRateLimitError,
ThankYouValidationError,
)
try:
await thankyou.generations.create(
model="wan/v2.6/text-to-video",
input={"prompt": "test"},
)
except ThankYouRateLimitError as error:
print("Rate limited", error.code, error.details)
except ThankYouValidationError as error:
print("Invalid request", error.details)
except ThankYouAuthenticationError:
print("Check your API key")
except ThankYouAPIError as error:
print(error.status, error.code, error.retryable, error.details)
Type Strategy
The SDK keeps generation request and response types close to the public API contract:
- top-level fields are
model,input,webhook,idempotency_key, andquote_id; inputincludes common hints such asprompt,text,negative_prompt,reference_assets,aspect_ratio,duration, andnum_images;- generation responses use one common
GenerationOutputitem withurl,mime_type,width,height,duration, andfps; - model-specific fields should be discovered with
thankyou.models.detail(model_id).input_schemaand passed as a normal dict.
This keeps newly released model fields and model-specific output fields usable without waiting for an SDK release.
from thankyou import GenerationInput, GenerationOutput, JsonObject, ThankYou
client = ThankYou(api_key="tk_test")
common_input: GenerationInput = {
"prompt": "A mountain landscape at golden hour",
"aspect_ratio": "16:9",
}
generation = await client.generations.create(
model="google/nano-banana/text-to-image",
input=common_input,
)
output: GenerationOutput = generation.output[0]
print(output.get("url"))
detail = await client.models.detail("wan/v2.6/text-to-video")
print(detail.input_schema)
model_specific_input: JsonObject = {
"prompt": "Cinematic drone shot of a mountain lake at sunrise",
"duration": "5",
"resolution": "1080P",
"camera_fixed": False,
}
quote = await client.generations.quote(
model="wan/v2.6/text-to-video",
input=model_specific_input,
)
Metadata
Release files for thankyouai 0.1.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 |
|---|---|---|---|---|
| thankyouai-0.1.0.tar.gz | 28.9 kB | With provenance | Details for thankyouai-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thankyouai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for thankyouai-0.1.0-py3-none-any.whl |
Total release size: 50.1 kB
Release files / thankyouai-0.1.0.tar.gz
| Download URL | thankyouai-0.1.0.tar.gz |
|---|---|
| Size | 28.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a247eac66a826fb4f3631710fdefed57160e4366aba0066ba9285324cccd666
|
|
BLAKE2b-256 checksum How to use checksums |
a303007fba139b5ab24396367e038b86d81447c21aebfc9d3ce1d5f60a3ed777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 18, 2026.
Transparency logRelease files / thankyouai-0.1.0-py3-none-any.whl
| Download URL | thankyouai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b0bf4c6f219fa93e7b41ab159fcbaa21501f5c43fc5ac35d6799fc7134e8e13
|
|
BLAKE2b-256 checksum How to use checksums |
a630a109d77838d21d25cad7457f0fac8beb27b9d959c27e3ef02d8ed6544956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 18, 2026.
Transparency logSecurity for thankyouai 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for thankyouai-0.1.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 Jun 18, 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.