curl --fail-with-body "https://api.tokenlab.sh/v1/worlds/generations/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-H "Authorization: Bearer sk-your-api-key"
import requests
import time
task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
while True:
response = requests.get(
f"https://api.tokenlab.sh/v1/worlds/generations/{task_id}",
headers={"Authorization": "Bearer sk-your-api-key"},
)
response.raise_for_status()
result = response.json()
if result["status"] in ["completed", "failed", "timeout"]:
print(result)
break
time.sleep(10)
const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const response = await fetch(`https://api.tokenlab.sh/v1/worlds/generations/${taskId}`, {
headers: { Authorization: 'Bearer sk-your-api-key' }
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result);
{
"id": "<string>",
"status": "pending",
"task_id": "<string>",
"operation_id": "<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": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "API key not found",
"type": "invalid_request_error"
}
}Worlds
取得 World 狀態
取得 World Labs Marble 世界生成任務的狀態與結果
GET
/
v1
/
worlds
/
generations
/
{id}
curl --fail-with-body "https://api.tokenlab.sh/v1/worlds/generations/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-H "Authorization: Bearer sk-your-api-key"
import requests
import time
task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
while True:
response = requests.get(
f"https://api.tokenlab.sh/v1/worlds/generations/{task_id}",
headers={"Authorization": "Bearer sk-your-api-key"},
)
response.raise_for_status()
result = response.json()
if result["status"] in ["completed", "failed", "timeout"]:
print(result)
break
time.sleep(10)
const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const response = await fetch(`https://api.tokenlab.sh/v1/worlds/generations/${taskId}`, {
headers: { Authorization: 'Bearer sk-your-api-key' }
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result);
{
"id": "<string>",
"status": "pending",
"task_id": "<string>",
"operation_id": "<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": {
"message": "Invalid API key provided",
"type": "invalid_api_key"
}
}{
"error": {
"message": "API key not found",
"type": "invalid_request_error"
}
}輪詢此端點以檢查 World Labs Marble 生成任務的狀態。如果建立回應中包含
poll_url,請優先呼叫該完整 URL。
已過期或不可用的公開任務可能回傳
404 async_task_not_found。無法確認目前 API 金鑰對任務的歸屬權限時,回傳 403 task_not_owned。路徑參數
string
必填
世界生成任務 ID。
回應
成功的狀態回應僅要求回傳id 和 status。任務別名、operation ID、世界資源、描述、費用和字串 error 僅在可用時回傳。任務完成不代表每個資源 URL 都存在。
string
公開任務 ID。
string
非同步任務識別別名。
string
上游 World Labs 操作 ID。
string
任務狀態:
pending、processing、completed、failed 或 timeout。string
生成完成後的上游 World Labs 世界 ID。
string
生成完成後返回的 Marble 世界 URL。
string
主要生成世界或模型 URL 的別名。
string
可用時返回的碰撞網格 GLB URL。
string
可用時返回的全景圖 URL。
string
可用時返回的縮圖 URL。
string
上游為生成世界返回的 caption。
object
生成費用詳情(如有),可能包含
total_credits。實際扣費請查看用量紀錄。string
任務失敗時的錯誤訊息。
curl --fail-with-body "https://api.tokenlab.sh/v1/worlds/generations/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
-H "Authorization: Bearer sk-your-api-key"
import requests
import time
task_id = "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
while True:
response = requests.get(
f"https://api.tokenlab.sh/v1/worlds/generations/{task_id}",
headers={"Authorization": "Bearer sk-your-api-key"},
)
response.raise_for_status()
result = response.json()
if result["status"] in ["completed", "failed", "timeout"]:
print(result)
break
time.sleep(10)
const taskId = 'ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const response = await fetch(`https://api.tokenlab.sh/v1/worlds/generations/${taskId}`, {
headers: { Authorization: 'Bearer sk-your-api-key' }
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
console.log(result);
授權
API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。
路徑參數
世界生成任務 ID。