Quickstart
Complete step-by-step guide to your first 3D generation
Quickstart
Generate your first 3D model in under 5 minutes.
Create an API Key
- Sign in to your account
- Go to Settings β API Keys
- Click Create Key, name it, and copy the key
Create a Generation Task
Send a POST request with your image and chosen model:
curl -X POST https://trellis2.app/api/v1/3d/generations \
-H "Authorization: Bearer tr_your_key" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/chair.jpg",
"model": "trellis2",
"mode": "async"
}'import requests
response = requests.post(
"https://trellis2.app/api/v1/3d/generations",
headers={
"Authorization": "Bearer tr_your_key",
"Content-Type": "application/json"
},
json={
"image_url": "https://example.com/chair.jpg",
"model": "trellis2",
"mode": "async"
}
)
task = response.json()
task_id = task["id"]
print(f"Task created: {task_id}")const response = await fetch('https://trellis2.app/api/v1/3d/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer tr_your_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
image_url: 'https://example.com/chair.jpg',
model: 'trellis2',
mode: 'async',
}),
});
const task = await response.json();
console.log('Task created:', task.id);Poll for the Result
import time
while True:
resp = requests.get(
f"https://trellis2.app/api/v1/tasks/{task_id}",
headers={"Authorization": "Bearer tr_your_key"}
)
data = resp.json()
if data["status"] == "completed":
print(f"Model URL: {data['data']['model_url']}")
break
elif data["status"] == "failed":
print(f"Error: {data['error']['message']}")
break
print(f"Progress: {data.get('progress', 0)}%")
time.sleep(3)while (true) {
const resp = await fetch(`https://trellis2.app/api/v1/tasks/${task.id}`, {
headers: { 'Authorization': 'Bearer tr_your_key' },
});
const data = await resp.json();
if (data.status === 'completed') {
console.log('Model URL:', data.data.model_url);
break;
} else if (data.status === 'failed') {
console.error('Error:', data.error.message);
break;
}
console.log(`Progress: ${data.progress}%`);
await new Promise((r) => setTimeout(r, 3000));
}Download Your Model
The completed task returns a model_url pointing to a downloadable GLB file:
curl -O https://r2.../model.glbThat's it! You've generated a 3D model from an image. See Available Models for all options.