Skip to content

About

Python API for Infinidream

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

infinidream Python API

copyright (c) 2025 e-dream, inc

Python client for the infinidream API. Generate animated videos ("dreams") with AI from text prompts and images, and create, manage, and playback dreams and playlists: everything you can do in the infinidream web app, from code.

installation

pip install git+https://github.com/e-dream-ai/python-api.git

To set up locally to test or run code, follow BUILD.md.

simple example

Get an API key from your profile on the server, and store it in a .env file. Then connect as follows:

import os
from dotenv import load_dotenv
from infinidream.client import create_client

load_dotenv()

client = create_client(
    backend_url=os.getenv("BACKEND_URL", "https://api-alpha.infinidream.ai/api/v1"),
    api_key=os.getenv("API_KEY")
)
user = client.get_logged_user()
print(user)

tests and more examples

There's a file to test api client:

python tests/run.py

this file has an example of every API call.

playlists and keyframes

Add many items to a playlist in one atomic request. The whole batch succeeds or nothing does, and the backend rejects it outright if any item is already on the playlist, so filter first:

from infinidream.types.playlist_types import PlaylistItemType

playlist = client.get_playlist(playlist_uuid)
already = {i["dreamItem"]["uuid"] for i in playlist["items"] if i.get("dreamItem")}

added = client.add_items_to_playlist(playlist_uuid, [
    {"type": PlaylistItemType.DREAM, "uuid": uuid}
    for uuid in dream_uuids if uuid not in already
])

At most 500 items per call. For a single item add_item_to_playlist is still the simpler choice.

Keyframes can be looked up by name rather than scanned for:

keyframe = client.find_keyframe_by_name("00248=22588")

# or page through matches yourself -- search is a substring match
page = client.get_keyframes(search="00248=", take=100)
print(page["count"], "matches")

AI generation

Generate a dream from a text prompt. The infinidream servers render it on GPUs and add it to your dreams when it's done:

import json

dream = client.create_dream_from_prompt({
    "name": "ancient forest",
    "prompt": json.dumps({
        "infinidream_algorithm": "wan-t2v",
        "prompt": "A serene morning in an ancient forest, golden sunlight "
                  "filtering through tall pine trees.",
        "size": "1280*720",
        "duration": 5,
    }),
})
print(dream["uuid"], dream["status"])

# later: poll until the status is "processed"
dream = client.get_dream(dream["uuid"])

Every algorithm and its parameters are in tests/gen.py; see also the Quick Start.

To smoke-test generation, set DREAM_UUID (a processed video dream) and STILL_UUID (a processed image dream) in your .env. See .env.example.

python tests/gen.py --algo ltx-i2v     # single algorithm
python tests/gen.py --all              # smoke test every endpoint
python tests/gen.py --all --timeout 7200

Available algorithms: animatediff, deforum, wan-t2v, wan-i2v, wan-i2v-lora, ltx-i2v, qwen-image, z-image-turbo, enhance, nvidia-uprez

For batch/playlist workflows see engines.

REST API

This Python client just wraps the servers' REST API. Its documentation is served by swagger on staging.

older code using edream_sdk

This package used to be called edream_sdk. import edream_sdk and the old names create_edream_client and EDreamClient still work, but new code should use infinidream, create_client and InfinidreamClient.

The pip name changed too. A requirements line naming edream_sdk (for example #egg=edream_sdk) now fails to install; change it to infinidream @ git+https://github.com/e-dream-ai/python-api.git@main.

About

Python API for Infinidream

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages