Skip to main content

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.0.1.dev0 — Phases 0 + 1 of a phased rollout. The :class:Rollout result type, :class:AsyncClient, retries, and bundled examples land in Phases 2–7. See docs/SDK_PLAN.md in the engine repo for the full schedule.

Install

pip install dream-engine

For mp4 → numpy frame decoding:

pip install "dream-engine[decode]"

Quickstart

import dream

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

with open("start.png", "rb") as f:
    frame_bytes = f.read()
with open("actions.npy", "rb") as f:
    actions_bytes = f.read()

response = model.predict(frame_bytes=frame_bytes, actions_bytes=actions_bytes)
print(response.engine_wall_ms, response.estimated_charge_usd)

# Always available:
with open("rollout.mp4", "wb") as f:
    f.write(response.mp4_bytes)

# When pip install "dream-engine[decode]" is installed:
print(response.frames.shape)  # (T, H, W, 3) uint8

You can pass file paths instead of bytes:

response = model.predict(frame_path="start.png", actions_path="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

batch = client.predict_batch(
    frame_bytes=frame_bytes,
    actions_bytes_list=[seq_0_bytes, seq_1_bytes, ...],   # K npy blobs
)
print(batch.batch_size, batch.engine_wall_ms)
for r in batch.rollouts:
    ...  # each is a PredictResponse, same shape as the single-rollout path

A higher-level model.predict_batch(...) lands in Phase 4.

Byte-level access

If you want to skip the catalog round-trip and call the wire endpoint directly:

response = client.predict(frame_path="start.png", actions_path="actions.npy")

This bypasses ModelHandle.predict()'s active-spec check; use it for scripts that already know which model the server is running.

Coming next

Phase What lands When
2 Rollout result type with .save_mp4(), .cost_usd, lazy .frames next
3 start_frame= accepts np.ndarray / PIL.Image / Path directly after 2
4 model.predict_batch(...) ergonomic wrap after 3
5 dream.AsyncClient after 4
6 Typed errors + automatic retries after 5
7 dream.examples.dreamdojo_grasp() bundled sample inputs after 6

PredictResponse / BatchResponse will be replaced by Rollout / Batch[Rollout] in Phase 2; both will be importable from dream until the 1.0.0 release for backwards compatibility.

License

Apache-2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dream_engine-0.2.0.tar.gz (542.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dream_engine-0.2.0-py3-none-any.whl (545.5 kB view details)

Uploaded Python 3

File details

Details for the file dream_engine-0.2.0.tar.gz.

File metadata

  • Download URL: dream_engine-0.2.0.tar.gz
  • Upload date:
  • Size: 542.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dream_engine-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6abfff64902dd9e712c143ff7dd7da30e44fc0bc2f43d9d2b370ebb96875d1cd
MD5 5c42e87cf20fcdd1ae01e5517505ba26
BLAKE2b-256 7e94f70df98582a353de188124b7b9f6c75163001d0c99624051da5d5e1845f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for dream_engine-0.2.0.tar.gz:

Publisher: sdk-release.yml on kingjulio8238/dreamengine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dream_engine-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dream_engine-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 545.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dream_engine-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed98e945cd21c7f18518af8213d9c5837cc5ae71d774cd51cc8d85f47bc567c9
MD5 416626d19bf0de82fddcb7cee5c19c91
BLAKE2b-256 f635e3db820f561b6a1636c5f40cf83c631a4b44a6cf61506b94cd8c72b4f1de

See more details on using hashes here.

Provenance

The following attestation bundles were made for dream_engine-0.2.0-py3-none-any.whl:

Publisher: sdk-release.yml on kingjulio8238/dreamengine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page