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.1.1.tar.gz (538.9 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.1.1-py3-none-any.whl (542.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dream_engine-0.1.1.tar.gz
  • Upload date:
  • Size: 538.9 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.1.1.tar.gz
Algorithm Hash digest
SHA256 19886ad860fb00551579c8b50f4fe330a04d1d36a2a9ed34d5fa26ec262a7f61
MD5 2a3104c83a958df2e1c16e0170140346
BLAKE2b-256 4989eed584b93ed9b5ce7a3c7d11d8b906696c43c20061069d9fe4558ed1578c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: dream_engine-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 542.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a665c633afb809390dc9bd040daf1afd4fc2faee68637c2c246dda19fd475d
MD5 3786ad6a8aff3b694e9d06e939e2103e
BLAKE2b-256 7ac8d0ae2c8d07eb174961f0b14b05b925835b30d22d82577ba3a70ff0c68d87

See more details on using hashes here.

Provenance

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