A small, readable Python client for the World Labs API, plus helpers to load SPZ splats and render videos with gsplat.
- Python 3.12+
- CUDA-capable GPU for gsplat rendering (optional if you only need API + SPZ load)
uv sync
source .venv/bin/activateexport WORLDLABS_API_KEY="..."
python examples/generate_world.pyfrom worldlabs_api.client import WorldLabsClient
from worldlabs_api.models import WorldTextPrompt, WorldsGenerateRequest
with WorldLabsClient(api_key="...") as client:
request = WorldsGenerateRequest(
display_name="Mystical Forest",
world_prompt=WorldTextPrompt(text_prompt="A mystical forest"),
)
op = client.generate_world(request)
done = client.poll_operation(op.operation_id)
world = done.responsefrom worldlabs_api.client import AsyncWorldLabsClient
from worldlabs_api.models import WorldTextPrompt, WorldsGenerateRequest
async with AsyncWorldLabsClient(api_key="...") as client:
request = WorldsGenerateRequest(
display_name="Mystical Forest",
world_prompt=WorldTextPrompt(text_prompt="A mystical forest"),
)
op = await client.generate_world(request)
done = await client.poll_operation(op.operation_id)
world = done.responsepython examples/generate_world.pypython examples/list_worlds.pypython examples/load_splat.py <world_id>python examples/render_video.py <world_id>python examples/export_ply.py <world_id>- The API key is passed via the
WLT-Api-Keyheader. - World generation is asynchronous; poll operations until
doneis true.