Tripo3D ve diğer sağlayıcıları kullanarak metin veya görsellerden 3D modeller oluşturun. Bu asenkron bir API’dir. Oluşturma yanıtları görev kimliğini döndürür ve uygun olduğunda tercih edilen poll_url değerini de içerebilir.
Herkese açık 3D operation değeri istek şekline göre çıkarılır: yalnızca prompt içeren istekler text-to-3d, image veya image_url içeren istekler image-to-3d olarak işlenir. Bu endpoint operation istek alanını sunmaz; legacy 3d-generation değerini göndermeyin.
İstek Gövdesi
model
string
varsayılan: "tripo-h3.1"
Kullanilacak model, ornegin tripo-h3.1 veya tripo-p1.0. Belirli bir giris turu veya cikti formatina guvenmeden once GET /v1/models?recommended_for=3d sorgulayin.
Oluşturulacak 3D modelin metin açıklaması.
Görselden 3D’ye üretim için Base64 kodlu görsel.
Görselden 3D’ye üretim için görselin URL’si.
Çıktı formatı: glb, fbx, obj veya usdz.
quality
string
varsayılan: "standard"
Kalite seviyesi: draft, standard veya high.
Model için stil ön ayarı.
Tekrarlanabilir üretim için seed değeri.
Son kullanıcı için benzersiz bir tanımlayıcı.
Yanıt
Durum sorgulama için görev kimliği (Task ID).
Adaptör tarafından döndürüldüğünde asenkron görev kimliği takma adı.
Uygun olduğunda dönen öncelikli polling URL’si.
Görev durumu: pending, processing, completed veya failed.
Görevin oluşturulma zamanına ait Unix zaman damgası.
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" ,
"task_id" : "ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"poll_url" : "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ,
"status" : "pending" ,
"created" : 1706000000 ,
"model" : "tripo-h3.1"
}