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": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm"
}'
import requests
response = requests.post(
"https://api.tokenlab.sh/v1/worlds/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "marble-1.1",
"prompt": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm",
},
)
task = response.json()
print(task["id"], task["poll_url"])
const response = await fetch('https://api.tokenlab.sh/v1/worlds/generations', {
method: 'POST',
headers: {
Authorization: 'Bearer sk-your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'marble-1.1',
prompt: 'Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm'
})
});
const task = await response.json();
console.log(task.id, task.poll_url);
{
"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": {}
}Tạo World
Tạo tác vụ sinh thế giới World Labs Marble
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": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm"
}'
import requests
response = requests.post(
"https://api.tokenlab.sh/v1/worlds/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "marble-1.1",
"prompt": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm",
},
)
task = response.json()
print(task["id"], task["poll_url"])
const response = await fetch('https://api.tokenlab.sh/v1/worlds/generations', {
method: 'POST',
headers: {
Authorization: 'Bearer sk-your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'marble-1.1',
prompt: 'Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm'
})
});
const task = await response.json();
console.log(task.id, task.poll_url);
{
"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": {}
}poll_url để kiểm tra trạng thái.
Chọn model Marble hiện có qua Models API.
Nội dung yêu cầu
world_prompt cho caller nâng cao. Các loại prompt được hỗ trợ là text, image, multi-image và video.world_prompt.type="multi-image" cùng reconstruct_images: true và tối đa 8 ảnh.true cho panorama có sẵn, false cho ảnh đơn thông thường, hoặc auto.public, allow_id_access, allowed_readers, allowed_writers. public: true yêu cầu tạo world có thể xem công khai.Phản hồi
pending, processing, completed hoặc failed.Giá
Xem Pricing API để biết giá hiện tại. Số tiền tính phí nằm trong bản ghi sử dụng;cost.total_credits được trả về là lượng sử dụng tạo world, không phải số tiền.
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": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm"
}'
import requests
response = requests.post(
"https://api.tokenlab.sh/v1/worlds/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "marble-1.1",
"prompt": "Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm",
},
)
task = response.json()
print(task["id"], task["poll_url"])
const response = await fetch('https://api.tokenlab.sh/v1/worlds/generations', {
method: 'POST',
headers: {
Authorization: 'Bearer sk-your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'marble-1.1',
prompt: 'Một thị trấn ven biển yên tĩnh lúc hoàng hôn với ngõ hẹp và ánh đèn ấm'
})
});
const task = await response.json();
console.log(task.id, task.poll_url);
Ủy quyền
Xác thực bằng Khóa API. Tạo hoặc quản lý khóa API trong Dashboard > API > API Keys.
Tiêu đề
Chính sách phân phối theo yêu cầu. Ghi đè lên các giá trị mặc định của API key và Workspace. Tự động thử TokenLab Verified trước và có thể chuyển đổi một lần sang Official chỉ trước khi xuất dữ liệu, chấp nhận thượng nguồn hoặc tạo tài nguyên cố định.
auto, verified, official Nội dung
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Đối tượng world_prompt gốc của World Labs dành cho người gọi nâng cao. Các loại lời nhắc được hỗ trợ là text, image, multi-image và video. Các tham chiếu nội dung có thể sử dụng source=media_asset với media_asset_id được chuẩn bị bởi /v1/worlds/media-assets/prepare-upload.
Mô hình Marble để sử dụng. Mặc định là marble-1.0 để khớp với mặc định tương thích World Labs hiện tại khi mô hình bị bỏ qua.
marble-1.0, marble-1.1, marble-1.1-plus Lời nhắc văn bản được sử dụng cho việc tạo thế giới bằng văn bản hoặc hình ảnh/video có hướng dẫn.
Tên hiển thị tùy chọn cho thế giới được tạo, tối đa 64 ký tự.
64Lời nhắc hình ảnh Base64 hoặc URL dữ liệu.
Lời nhắc URL hình ảnh.
Lời nhắc đa hình ảnh rút gọn. Cung cấp tối đa 4 hình ảnh. Sử dụng world_prompt.reconstruct_images=true gốc cho tối đa 8 hình ảnh.
4Lời nhắc URL video.
Liệu lời nhắc hình ảnh có phải là ảnh toàn cảnh hiện có hay không. Sử dụng true cho đầu vào pano, false cho đầu vào hình ảnh đơn lẻ hoặc auto.
Seed tùy chọn từ 0 đến 4294967295.
0 <= x <= 4294967295Thẻ World Labs tùy chọn. Cung cấp tối đa 10 thẻ, mỗi thẻ tối đa 32 ký tự.
1032Đối tượng quyền World Labs tùy chọn.
Định danh người dùng cuối.