Skip to main content

Wan27 Python client

A dependency-free Python 3.10+ client for Wan27 AI image and video generation. Read your account, discover models and input schemas, estimate credit costs, create tasks with retained request IDs, and retrieve actual outputs.

The client is MIT licensed. The hosted API requires an active paid Wan27 subscription; generation spends credits. Credit packs alone do not enable API access. This is a service client, not a distribution of Alibaba model weights.

Usage

PyPI publication is pending. Install from the checked-out source with pip install . until the registry release is available.

import os
from uuid import uuid4
from wan27 import Wan27

client = Wan27(os.environ["WAN27_ACCESS_TOKEN"])
print(client.account())
print(client.model("wan2.7-image"))
request = {"modelId": "wan2.7-image", "prompt": "A paper crane on a desk", "resolution": "2K"}
print(client.estimate(request))

# Only after the estimated credit spend has been authorized:
request_id = str(uuid4())  # persist this ID and input before submitting
created = client.generate(request, request_id=request_id)
task_id = created["task"]["id"]
print(client.task(task_id))

Use an existing access token in your server environment. The SDK does not read or export the CLI credential vault. Use the CLI for interactive browser authentication and image uploads. Do not paste tokens into chats or commit them to source control.

Responses preserve the service's JSON object. Read each model's current schema; do not assume unsupported options or fixed credit prices. Wan27Error exposes code and HTTP status.

There is no automatic generation retry. On an ambiguous network error, inspect tasks() and reuse the original request_id and input. Poll task() with a bounded wait. Pending tasks are not finished results; a polling timeout does not cancel them. A new generation after a failed task is a new spend.

All requests use the official HTTPS origin, reject redirects, and enforce request/response size limits. The default network timeout is 120 seconds. No token is saved by this package.

Development

PYTHONPATH=src python -m unittest discover -s tests -v
python -m build

Tests use offline fixtures and do not perform paid generations. Live authenticated generation is not included in this test suite.

Website · API workflow guide · MCP setup · Pricing · Source

Metadata

Release files for wan27 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 wan27 0.1.0
File Size Uploaded Provenance Actions
wan27-0.1.0.tar.gz 8.0 kB With provenance Details for wan27-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.0 kB

Release files / wan27-0.1.0.tar.gz

Download URL wan27-0.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
40dd69380605b705aae261b2c5b7d55044bb983e438a67bb0808ca38ebf194dc
BLAKE2b-256 checksum
How to use checksums
9aeab71abf93d6404eca422598bb49e63fea419d5ebc3f0a9676710e1b2c5c8c
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 29, 2026.

Transparency log

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

Download URL wan27-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb8a56054bce0645c7bac5e8494a0aee463bd4a775b88411943226e109e461d9
BLAKE2b-256 checksum
How to use checksums
a320cb8aeb96a6cf61b04ee5b24f1247c3067c90fdb453d550b25c435ff4ab61
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 29, 2026.

Transparency log

Security for wan27 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.

Select from 2 files

Attestation for wan27-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 Oct 29, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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