WorldJen Python SDK for running evaluation pipelines on video and world models
Project description
WorldJen Python SDK
WorldJen provides high-performance benchmarks for video and world models. It empowers researchers and builders with a unified platform for accurate, fast, and clear evaluations across dimensions like subject consistency, motion smoothness, physical mechanics, and more.
This package provides the Python SDK and CLI. Use it to create runs, manage models and API keys, and operate GPU runners from the command line or from your own code.
The SDK provides the same capabilities as the runs, models, and api-keys CLI commands, plus the high-level worldjen.run() for end-to-end pipeline execution. Runner commands (systemd, register, etc.) remain CLI-only.
Requirements: Python 3.10+
Installation
Install the core package (for programmatic runs and CLI):
pip install worldjen
With uv:
uv pip install worldjen
If you use a virtual environment, activate it so the worldjen CLI is on your PATH (e.g. source .venv/bin/activate).
To run the runner (Celery worker for GPU execution), install the optional runner extra:
pip install worldjen[runner]
# or
uv pip install worldjen[runner]
The runner requires a Linux system with systemd for service management.
Configuration
Set your API key via worldjen.config() or environment variables:
WORLDJEN_API_KEY— API key (required for creating runs and for CLI commands that modify data)WORLDJEN_VIDEO_DIR— Directory for cached prompts and run outputs (default:~/.worldjen/data/videos)
import worldjen
worldjen.config(api_key="your-api-key")
worldjen.config(video_dir="/path/to/videos") # optional
Usage
Dimensions
Use the Dimensions enum when specifying evaluation dimensions:
from worldjen import Dimensions
dims = [Dimensions.SUBJECT_CONSISTENCY, Dimensions.SCENE_CONSISTENCY]
# or strings: dims = ["subject_consistency", "scene_consistency"]
Running a pipeline
Your pipeline must be one of:
- A callable:
pipeline(prompt, **kwargs) -> list[frames] - An object with a
generatemethod:pipeline.generate(prompt, **kwargs) -> list[frames] - An object with an
infermethod:pipeline.infer(prompt, **kwargs) -> list[frames]
Frames can be PIL Images or numpy arrays (HWC; the SDK handles writing to video).
import worldjen
def my_pipeline(prompt, **kwargs):
# Generate frames from prompt (text-to-video)
...
return frames # list of PIL or numpy arrays
result = worldjen.run(
my_pipeline,
dimensions=[worldjen.Dimensions.SUBJECT_CONSISTENCY],
run_name="my-eval-run",
model_id="my-org/my-model-checkpoint-xyz",
wait_for_evals=True,
# optional pipeline kwargs: num_frames=16, etc.
)
print(result.run_id, result.status, result.video_paths, result.eval_results)
if result.error_message:
print("Error:", result.error_message)
On failure (run creation, pipeline error, or upload), the run is marked failed and RunResult includes status="failed" and error_message.
Examples
See the examples/ directory for runnable scripts (e.g. LTX-Video with real prompts from worldjen/prompts/ and a single dimension, with notes on Dimensions.ALL and multiple dimensions).
API summary
High-level (primary)
worldjen.config(api_key=..., video_dir=..., api_url=..., timeout=...)— Set or override config; returns the config object.worldjen.run(pipeline, dimensions, run_name=None, model_id=None, wait_for_evals=True, **pipeline_kwargs)— End-to-end: create a run, run your pipeline locally, generate and upload videos, then optionally poll until evals are ready. ReturnsRunResult(run_id, video_paths, output_dir, eval_results, status, error_message).
Run management (worldjen.runs)
Lower-level API for inspecting and managing runs (equivalent to most worldjen runs CLI commands):
worldjen.runs.create(name, dimensions, *, runner_id, model_id, run_instructions=None)— Create a run and enqueue it on the given runner (same as the web UI). Returns run ID. Requires keyword-onlyrunner_idandmodel_id(MongoDB ids from the dashboard). Useworldjen.run()for end-to-end local pipeline execution; that path uses an internal API call and does not require a worker queue. For rare cases that only need a run record without enqueueing, useworldjen._api.create_run(omitrunner_id).worldjen.runs.list_runs(status=None, page=1, limit=50)— List runs.worldjen.runs.get(run_id)— Fetch run metadata and result data.worldjen.runs.cancel(run_id)— Cancel a run.worldjen.runs.delete(run_id)— Delete a run.worldjen.runs.get_logs(run_id)— Fetch run logs.worldjen.runs.get_csv(run_id)— Fetch run CSV as bytes.worldjen.runs.get_videos(run_id)— List video metadata (id, prompt, url).worldjen.runs.download_videos(run_id, output_dir=".")— Download all run videos to a directory.
Model management (worldjen.models)
worldjen.models.list_user(sort_by=None)— List your models.worldjen.models.list_base(sort_by=None)— List base (suggested) models.worldjen.models.list_ref(sort_by=None)— List reference models.worldjen.models.create(name, provider, hf_repo_id, model_type, encrypted_tokens=None)— Create a model. For private repos, use--hf-tokenvia CLI or configure in the dashboard.worldjen.models.delete(model_id)— Delete a model.
API keys (worldjen.api_keys)
worldjen.api_keys.list_keys()— List API keys.worldjen.api_keys.create(name=None, expires_in=None)— Create an API key.worldjen.api_keys.revoke(key_id)— Revoke an API key.
Create and revoke are also available in the dashboard.
CLI
All CLI commands that create or read data accept an API key via the WORLDJEN_API_KEY environment variable or --api-key. To point at a non-production API (developers only), set WORLDJEN_API_URL in the environment; it is intentionally not listed in worldjen --help.
Runs
worldjen runs create --name NAME --dimensions DIM1,DIM2 --runner-id RUNNER_ID --model-id MODEL_ID [--run-instructions JSON_OR_PATH]— Create a run on a worker queue (same as the dashboard).--run-instructionsis inline JSON or a path to a.jsonfile.worldjen runs list [--status STATUS] [--page N] [--limit N]— List runs.worldjen runs get RUN_ID— Show run metadata.worldjen runs cancel RUN_ID— Cancel a run.worldjen runs delete RUN_ID— Soft-delete a run.worldjen runs logs RUN_ID— Print run logs.worldjen runs csv RUN_ID [--output FILE]— Download run CSV.worldjen runs videos RUN_ID— List video metadata (id, prompt, url).worldjen runs download-videos RUN_ID [--output-dir DIR]— Download all run videos.
Dimensions
worldjen dimensions list [--json]— List all available evaluation dimensions (id, name, description). Pass--jsonfor machine-readable output.
Models
worldjen models list— List your models.worldjen models list-base— List base (suggested) models.worldjen models list-ref— List reference models.worldjen models create --name NAME --provider P --hf-repo-id REPO --type text_to_video [--hf-token TOKEN]— Create a model. For private repos, pass--hf-token(or setWORLDJEN_HF_TOKEN); the token is encrypted per registered runner so runners can pull the model.worldjen models delete MODEL_ID— Delete a model.
API keys
worldjen api-keys list— List API keys. Create and revoke keys in the dashboard.
Runner
Runner commands require the worldjen[runner] extra. Local commands act on this machine (config file, systemd service). Backend commands act on your account’s runner resources via the API.
Backend (API / your account) — require WORLDJEN_API_KEY or --api-key:
worldjen runner create [--name NAME] [--data-dir DIR]— Create a runner resource in the backend, register this machine, install the systemd service, and start it.worldjen runner delete [--runner-id ID]— Delete the runner from the backend; also stops and uninstalls the local service. Fails if the runner has queued runs.worldjen runner list— List runners for your account.
Local (this machine) — act on local config and systemd; Linux with systemd required for install/start/stop/logs:
worldjen runner register --token TOKEN [--config PATH]— Register this machine using a one-time token from the web UI; writesrunner.conf, then optionally installs and starts the service.worldjen runner install [--data-dir DIR]— Install and start the systemd service (requires an existingrunner.conffrom a priorregister).worldjen runner uninstall— Stop and uninstall the systemd service.worldjen runner start— Start the installed service.worldjen runner stop— Stop the service.worldjen runner status— Showsystemctl statusfor the worldjen-runner service.worldjen runner logs [-f] [-n N]— Tail logs of the systemd service.
The runner runs as a Celery worker. Jobs are submitted from the web UI or when you create a run and select a runner in the dashboard.
Links
- WorldJen — Web app and dashboard
- Documentation — Full docs and guides
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 Distributions
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 worldjen-0.2.9-py3-none-any.whl.
File metadata
- Download URL: worldjen-0.2.9-py3-none-any.whl
- Upload date:
- Size: 275.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b49c6a9374b5cdbb624cd27439f3f722382734d048eff92529557c6575d2729
|
|
| MD5 |
c2b7799fb63b137f0053df42e47be0e1
|
|
| BLAKE2b-256 |
c300d811a67b6de76af57aa3343d75ef68b5022854b714fad3ead813ceea3bd7
|