Python SDK for Dream Engine — frontier video world models, served by Dream Labs.
Project description
dream-engine — Python SDK for Dream Engine
dream-engine is the official Python SDK for Dream Engine,
the inference engine for video world models from Dream Labs. Run frontier
world models (DreamDojo · GR-1, more on the way) over HTTP with a small,
typed client.
Status: v0.4.0 — stable release.
Rollout,AsyncClient, typed errors, retries,predict_batch, and bundled examples are all available. Seesdk/python/CHANGELOG.mdfor the full version history.
Install
pip install dream-engine
For mp4 → numpy frame decoding:
pip install "dream-engine[decode]"
Quickstart
import dream
import numpy as np
from PIL import Image
client = dream.Client() # reads DREAM_API_KEY + DREAM_BASE_URL
model = client.models.get("dreamdojo-2b-gr1") # ModelHandle (typed; checks the catalog)
print(model.action_dim, model.resolution) # 384, (480, 640) — flat accessors
img = Image.open("start.png")
acts = np.load("actions.npy") # (48, 384) float32
rollout = model.predict(start_frame=img, actions=acts)
print("frames:", rollout.frames, "cost:", rollout.cost_usd)
rollout.save("rollout.mp4")
# Access decoded frames as a numpy array (requires [decode] extra):
print(rollout.video().shape) # (T, H, W, 3) uint8
You can also pass file paths or raw bytes:
# Paths (str or Path) — SDK reads the file and encodes for the wire
rollout = model.predict(start_frame="start.png", actions="actions.npy")
Set DREAM_API_KEY in your environment, or pass api_key=... to the
Client(...) constructor. Mint keys at https://dreamlabs.ai/dashboard.
List the catalog
for handle in client.models.list():
print(handle.slug, handle.spec.name, "active" if handle.active else "")
Visual MPC — K candidates in one server roundtrip
import numpy as np
candidates = np.random.randn(8, 48, 384).astype(np.float32) # (K, T, action_dim)
batch = model.predict_batch(start_frame=img, actions=candidates)
print(batch.batch_size, batch.engine_wall_ms)
for r in batch.rollouts:
print(r.cost_usd)
Wire-level access (advanced)
If you want to skip the ModelHandle layer and call the endpoint with
pre-encoded bytes:
# Low-level: bypasses active-spec check and input coercion
response = client.predict(frame_bytes=frame_bytes, actions_bytes=actions_bytes)
Prefer
model.predict(start_frame=…, actions=…)for most use cases. The wire-level path is for scripts that already have wire-ready bytes and don't need the typedRolloutresult.
License
Apache-2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dream_engine-0.4.0.tar.gz.
File metadata
- Download URL: dream_engine-0.4.0.tar.gz
- Upload date:
- Size: 572.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
267d27c9c7c155f8cbad4a42138edbbf8a23fb4bbd2f6d7f8cf68d255049bc21
|
|
| MD5 |
065584e1caf55e81d1f7fc0826e7ea6b
|
|
| BLAKE2b-256 |
2df6d49f9b6f58d96863bd92ad2931b1d126ba30a054666dcbf5ae61aef6aa6d
|
File details
Details for the file dream_engine-0.4.0-py3-none-any.whl.
File metadata
- Download URL: dream_engine-0.4.0-py3-none-any.whl
- Upload date:
- Size: 577.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b50c07072159ce85ede2052947b0f426abc649dcdb6fc6d4fbb8bc06cf322b9f
|
|
| MD5 |
80ee5231ccd63932c5dfbfaa52f5bbfc
|
|
| BLAKE2b-256 |
f6af793926c322afbec72748a43031b310beae09f2e6d49954441273ddaad3dc
|