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.1.tar.gz (546.0 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.1-py3-none-any.whl (547.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dream_engine-0.2.1.tar.gz
  • Upload date:
  • Size: 546.0 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.1.tar.gz
Algorithm Hash digest
SHA256 25aa3e89af07e4a4e00f0cbb16998a27611ad80971431880f8b70394da11dcb9
MD5 e7ba94a83bfab8209e679592146c5f0e
BLAKE2b-256 38458fc3676805ce4dadacd9941bc03c17a750ebda174f40425b439a1838acae

See more details on using hashes here.

Provenance

The following attestation bundles were made for dream_engine-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: dream_engine-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 547.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b6fb256e357f28e357baed7113c968a50ae1eb6f4348e8cb3f2a79b5107ff290
MD5 713df0c997c97551f7e0607834d03a1d
BLAKE2b-256 eccc4a974ab94bf9cc5b217d204ed18b855df282fd00f9adb0c289a8ceaaadc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for dream_engine-0.2.1-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