Hasilkan model 3D dari teks atau gambar menggunakan Tripo3D dan penyedia lainnya. Ini adalah API asinkron. Respons create mengembalikan identitas tugas dan, ketika tersedia, juga dapat menyertakan poll_url yang diprioritaskan.
Operation 3D publik disimpulkan dari bentuk request: request yang hanya berisi prompt diproses sebagai text-to-3d, sedangkan request dengan image atau image_url diproses sebagai image-to-3d. Endpoint ini tidak mengekspos field request operation; jangan kirim nilai legacy 3d-generation.
Isi Permintaan
model
string
default: "tripo-h3.1"
Model yang digunakan, misalnya tripo-h3.1 atau tripo-p1.0. Kueri GET /v1/models?recommended_for=3d sebelum bergantung pada jenis input atau format output tertentu.
Deskripsi teks dari model 3D yang akan dihasilkan.
Gambar dengan encoding Base64 untuk pembuatan image-to-3D.
URL gambar untuk pembuatan image-to-3D.
Format output: glb, fbx, obj, atau usdz.
Tingkat kualitas: draft, standard, atau high.
Preset gaya untuk model tersebut.
Seed untuk pembuatan yang dapat direproduksi.
Pengidentifikasi unik untuk pengguna akhir.
Respons
ID tugas untuk polling status.
Alias identifier tugas asinkron ketika dikembalikan oleh adapter.
URL polling prioritas ketika tersedia.
Status tugas: pending, processing, completed, atau failed.
Timestamp Unix dari pembuatan tugas.
cURL
Python
JavaScript
Go
PHP
curl -X POST "https://api.tokenlab.sh/v1/3d/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "tripo-h3.1",
"prompt": "A detailed medieval castle with towers",
"format": "glb",
"quality": "high"
}'
import requests
response = requests.post(
"https://api.tokenlab.sh/v1/3d/generations" ,
headers = { "Authorization" : "Bearer sk-your-api-key" },
json = {
"model" : "tripo-h3.1" ,
"prompt" : "A detailed medieval castle with towers" ,
"format" : "glb" ,
"quality" : "high"
}
)
task_id = response.json()[ "id" ]
print ( f "Task ID: { task_id } " )
const response = await fetch ( 'https://api.tokenlab.sh/v1/3d/generations' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer sk-your-api-key' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
model: 'tripo-h3.1' ,
prompt: 'A detailed medieval castle with towers' ,
format: 'glb' ,
quality: 'high'
})
});
const data = await response . json ();
console . log ( `Task ID: ${ data . id } ` );
package main
import (
" bytes "
" encoding/json "
" fmt "
" net/http "
)
func main () {
payload := map [ string ] interface {}{
"model" : "tripo-h3.1" ,
"prompt" : "A detailed medieval castle with towers" ,
"format" : "glb" ,
"quality" : "high" ,
}
body , _ := json . Marshal ( payload )
req , _ := http . NewRequest ( "POST" , "https://api.tokenlab.sh/v1/3d/generations" , bytes . NewBuffer ( body ))
req . Header . Set ( "Authorization" , "Bearer sk-your-api-key" )
req . Header . Set ( "Content-Type" , "application/json" )
client := & http . Client {}
resp , _ := client . Do ( req )
defer resp . Body . Close ()
var result map [ string ] interface {}
json . NewDecoder ( resp . Body ). Decode ( & result )
fmt . Printf ( "Task ID: %s \n " , result [ "id" ])
}
<? php
$ch = curl_init ( 'https://api.tokenlab.sh/v1/3d/generations' );
curl_setopt_array ( $ch , [
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_POST => true ,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json' ,
'Authorization: Bearer sk-your-api-key'
],
CURLOPT_POSTFIELDS => json_encode ([
'model' => 'tripo-h3.1' ,
'prompt' => 'A detailed medieval castle with towers' ,
'format' => 'glb' ,
'quality' => 'high'
])
]);
$response = curl_exec ( $ch );
curl_close ( $ch );
$data = json_decode ( $response , true );
echo "Task ID: " . $data [ 'id' ];
{
"id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"status" : "pending" ,
"created" : 1706000000 ,
"model" : "tripo-h3.1"
}