Worlds

创建 World

使用文字、图片或视频创建可探索的 3D World

POST
/v1/worlds/generations

创建可探索的 3D World。响应会返回任务 ID 和 poll_url,通过这个地址查询进度和结果。

通过 Models API 选择当前可用的 Marble 模型。

请求体

modelstring默认值: marble-1.0

通过 Models API 选择当前可用的 Marble 模型。

promptstring

用于纯文本生成的文本提示词,也可作为图片或视频输入时的引导。

world_promptobject

World Labs world_prompt 对象,支持 text、image、multi-image 和 video。

imagestring

Base64 或 data URL 图片提示。

image_urlstring

图片 URL 提示。

imagesarray

用于快捷多图生成的多个图片提示。最多提供 4 张图片。若使用原生 World Labs 重建模式,请传入 world_prompt.type="multi-image"、reconstruct_images: true,并最多提供 8 张图片。

video_urlstring

视频 URL 提示。

is_panoboolean | string

对于图片输入,设置为 true 表示已有全景图,false 表示普通单图,或使用 auto。

seedinteger

可选随机种子,范围为 0 到 4294967295。

display_namestring

可选的生成世界显示名称,最多 64 个字符。

tagsarray

可选的 World Labs 标签。最多提供 10 个标签,每个标签最多 32 个字符。

permissionobject

可选的可见性和访问设置:public、allow_id_access、allowed_readers 和 allowed_writers。public: true 请求创建公开可见的 World。

响应

idstring

TokenLab 任务 ID。

task_idstring

同一个任务 ID 的兼容字段名。

operation_idstring

World Labs 操作 ID。

poll_urlstring

任务状态查询地址。

statusstring

任务状态:pending、processing、completed 或 failed。

world_marble_urlstring

生成完成后返回的 Marble 世界 URL。

glb_urlstring

可用时返回的碰撞网格 GLB URL。

pano_urlstring

可用时返回的全景图 URL。

计费

通过 Pricing API 查询当前价格。实际扣费以用量记录为准;返回的 cost.total_credits 是生成用量,不是货币金额。

请求

curl -X POST "https://api.tokenlab.sh/v1/worlds/generations" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "marble-1.1",
    "prompt": "夕阳下安静的海边小镇,有狭窄小巷和温暖灯光"
  }'
{  "id": "string",  "task_id": "string",  "operation_id": "string",  "status": "pending",  "poll_url": "string",  "world_id": "string",  "world_marble_url": "string",  "model_url": "string",  "glb_url": "string",  "pano_url": "string",  "thumbnail_url": "string",  "caption": "string",  "cost": {},  "error": "string",  "error_details": {    "projection_version": 0,    "status": 400,    "message": "string",    "type": "string",    "code": "string",    "param": "string",    "retryable": true,    "upstream": {      "source": "string",      "code": "string",      "message": "string",      "param": "string"    }  }}

授权

BearerAuth
AuthorizationBearer <token>

API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。

位置: header

请求头

X-TokenLab-Delivery-Policy?string

单次请求的交付策略。覆盖 API 密钥和 Workspace 的默认设置。自动优先尝试 TokenLab Verified,并在输出、请求接受或持久资源创建之前,可能会切换一次至仅限 Official。

可选值

  • "auto"
  • "verified"
  • "official"

请求体

application/json

响应

application/json

application/json

application/json