Skip to main content

Revana Python SDK

The official Python SDK and CLI for Revana: one API key for 200+ image, video, music and chat models, including Seedance 2.5, Veo 3.1, Kling, Nano Banana Pro, GPT Image, Wan, Hailuo and MiniMax. Each request takes the cheapest working route first and falls back automatically. A failed generation is never charged.

  • Sync and async clients (Revana, AsyncRevana) built on httpx
  • Fully typed (py.typed), Python 3.9+
  • Automatic retries with idempotency keys, so a retry never starts a second paid generation
  • A revana command-line tool

Prices for every model: revana.si/pricing · API reference: revana.si/openapi.json

Install

pip install revana

Create an API key at revana.si/dashboard and set it:

export REVANA_API_KEY=rv_...

Text to video

from revana import Revana

revana = Revana()  # reads REVANA_API_KEY

video = revana.generate(
    model="seedance-2.5",
    input={"prompt": "a corgi surfing at sunset", "duration": 5, "resolution": "720p"},
    max_cost_usd=2,  # never charge more than this
)
print(video["output"]["urls"][0], video["cost_usd"])

with open("corgi.mp4", "wb") as f:
    f.write(revana.generations.download(video["id"]))

generate() submits the generation and polls until it finishes. To do it in steps:

gen = revana.generations.create(model="nano-banana-pro", input={"prompt": "a red fox, studio light"})
gen = revana.generations.wait(gen["id"], timeout=600, on_update=lambda g: print(g["status"]))

Async

import asyncio
from revana import AsyncRevana

async def main():
    async with AsyncRevana() as revana:
        prompts = ["a lighthouse in fog", "a neon city at night", "a bowl of ramen"]
        images = await asyncio.gather(
            *(revana.generate(model="nano-banana-pro", input={"prompt": p}) for p in prompts)
        )
        for img in images:
            print(img["output"]["urls"][0])

asyncio.run(main())

Upload a local file (image to video)

References are passed as URLs. For a file on your computer, uploads.upload() gets a link, sends the bytes and returns a URL that works for 14 days. Uploads are free; images up to 30 MB, video 50 MB, audio 15 MB.

up = revana.uploads.upload("product.png")  # the content type is guessed from the name
video = revana.generate(
    model="seedance-2.5",
    input={"prompt": "the bottle spins slowly on a marble table", "image_url": up["url"], "duration": 5},
)

Raw bytes work too: revana.uploads.upload(data, content_type="image/jpeg").

Models and balance

for m in revana.models.list():  # no key needed
    print(m["id"], m.get("kind"), m.get("price"))

print(revana.models.get("veo-3.1-fast"))
print(revana.balance()["available_usd"])

Chat completions

OpenAI-compatible, on the same key:

reply = revana.chat.completions.create(
    model="gpt-5-mini",
    messages=[{"role": "user", "content": "Write a 10-word ad for running shoes"}],
)
print(reply["choices"][0]["message"]["content"])

Errors

from revana import Revana, RevanaError, GenerationFailedError, WaitTimeoutError

try:
    video = revana.generate(model="seedance-2.5", input={"prompt": "..."}, max_cost_usd=1)
except GenerationFailedError as e:
    # The generation ran and failed. Nothing was charged.
    print(e.code, e.retryable, e.generation["id"])
except WaitTimeoutError as e:
    # Still running after `timeout` seconds; it may still finish.
    print("still waiting on", e.generation["id"])
except RevanaError as e:
    # The API refused the request, e.g. 402 insufficient_credits or 422 invalid_input.
    print(e.status, e.code, e.message)
Error When Fields
RevanaError An HTTP error from the API, a missing key (missing_api_key, raised before any request), or a network failure after the retries (status 0, network_error / timeout) status, code, message, body
GenerationFailedError The generation ended in failed. Never charged. generation, code, retryable
WaitTimeoutError Waiting took longer than timeout generation

Retries and idempotency

429, 5xx and network errors are retried up to max_retries times (default 3), honoring Retry-After (up to 60 s) and otherwise backing off exponentially. Only requests that are safe to repeat are retried: GETs, and POSTs that carry an Idempotency-Key. generations.create() always sends one (a random UUID unless you pass idempotency_key=), reused across its retries, so the same generation is never started twice. Pass your own key to make a retry safe across processes too.

Configuration

Revana(
    api_key=None,        # default: REVANA_API_KEY
    base_url=None,       # default: REVANA_BASE_URL, else https://api.revana.si
    max_retries=3,
    timeout=60,          # seconds per request
    http_client=None,    # your own httpx.Client / httpx.AsyncClient
)

CLI

revana models seedance                  # list models with prices (no key needed)
revana balance
revana generate seedance-2.5 "a corgi surfing at sunset" --duration 5 --resolution 720p --max-cost 2 -o corgi.mp4
revana generate kling-2.6-pro "she turns and smiles" --image ./photo.jpg --aspect 9:16   # local files are uploaded
revana get gen_...
revana download gen_... -o out.mp4
revana upload ./reference.png

Generate options: --duration, --resolution, --aspect, --audio, --image, --end-image, --ref (repeatable), --video, --set key=value (repeatable), --max-cost, -o/--out, --no-wait, --json. Run revana --help for the full list.

License

MIT

Metadata

Release files for revana 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 revana 0.1.0
File Size Uploaded Provenance Actions
revana-0.1.0.tar.gz 18.8 kB Without provenance Details for revana-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 39.0 kB

Release files / revana-0.1.0.tar.gz

Download URL revana-0.1.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
71c259bc3464e92efdeb52f253c389a54b931661f69d2a5c174db09aea2c611e
BLAKE2b-256 checksum
How to use checksums
ed94b1a8ddbb867ab00b2fab23efeebc603cf2964cbabec720e46e935f7939bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL revana-0.1.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c2b4b888de4b5611b4ffcf67f78f12e23a050a016a5810f4d360e610f7f621b
BLAKE2b-256 checksum
How to use checksums
3e544bc9aba8fec32e2843c0eda427d7b4fd2d1367804eff40a169c5073f1b61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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