Skip to content

worldlabsai/worldlabs-api-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

World Labs API Python Client

A small, readable Python client for the World Labs API, plus helpers to load SPZ splats and render videos with gsplat.

Requirements

  • Python 3.12+
  • CUDA-capable GPU for gsplat rendering (optional if you only need API + SPZ load)

Install (uv)

uv sync
source .venv/bin/activate

Quickstart

export WORLDLABS_API_KEY="..."
python examples/generate_world.py

Client Usage

Sync Client

from 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.response

Async Client

from 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.response

Examples

Generate a World

python examples/generate_world.py

List All Worlds

python examples/list_worlds.py

Load SPZ into Gaussian3D

python examples/load_splat.py <world_id>

Render a Turntable Video

python examples/render_video.py <world_id>

Export to PLY

python examples/export_ply.py <world_id>

Notes

  • The API key is passed via the WLT-Api-Key header.
  • World generation is asynchronous; poll operations until done is true.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages