The Tripo3d Python SDK is the official Python client library for the Tripo 3D Generation API. With this SDK, you can easily generate high-quality 3D models.
- Text-to-3D model generation
- Image-to-3D model generation
- Multi-view to 3D model generation
- Text-to-image and advanced image generation (multi-model, multi-reference, templates)
- Multiview image generation and editing
- One-shot model animation (auto rig + retarget)
- External model import (GLB / OBJ / FBX / STL)
- Mesh editing including mesh segmentation, mesh completion and smart lowpoly
- Model conversion and stylization
- Rigging and retarget
- Asynchronous API support
- Complete type hints
pip install tripo3dimportasynciofromtripo3dimportTripoClientasyncdefmain():
# Initialize client with API keyclient=TripoClient(api_key="your_api_key")
# Or read from environment variable# export TRIPO_API_KEY=your_api_key# client = TripoClient()# Use the client# ...# Close client connectionawaitclient.close()
# Run async functionasyncio.run(main())importasynciofromtripo3dimportTripoClientasyncdeftext_to_model_example():
asyncwithTripoClient() asclient:
# Create text to 3D model tasktask_id=awaitclient.text_to_model(
prompt="A cute cat",
negative_prompt="low quality, blurry",
)
print(f"Task ID: {task_id}")
# Wait for task completiontask=awaitclient.wait_for_task(task_id)
iftask.status==TaskStatus.SUCCESS:
print(f"Task completed successfully!")
# Download model filesdownloaded_files=awaitclient.download_task_models(task, "./output")
# Print downloaded file pathsformodel_type, file_pathindownloaded_files.items():
iffile_path:
print(f"Downloaded {model_type}: {file_path}")
asyncio.run(text_to_model_example())importasynciofromtripo3dimportTripoClientasyncdefimage_to_model_example():
asyncwithTripoClient() asclient:
# Create image to 3D model tasktask_id=awaitclient.image_to_model(
image="path/to/your/image.jpg",
)
print(f"Task ID: {task_id}")
# Wait for task completion and show progresstask=awaitclient.wait_for_task(task_id, verbose=True)
iftask.status==TaskStatus.SUCCESS:
print(f"Task completed successfully!")
# Download model filesdownloaded_files=awaitclient.download_task_models(task, "./output")
# Print downloaded file pathsformodel_type, file_pathindownloaded_files.items():
iffile_path:
print(f"Downloaded {model_type}: {file_path}")
asyncio.run(image_to_model_example())importasynciofromtripo3dimportTripoClientasyncdefmultiview_to_model_example():
asyncwithTripoClient() asclient:
# Create multi-view to 3D model tasktask_id=awaitclient.multiview_to_model(
images=[
"path/to/front.jpg", # Front view (required)"path/to/back.jpg", # Back view (optional)"path/to/left.jpg", # Left view (optional)"path/to/right.jpg"# Right view (optional)
],
)
print(f"Task ID: {task_id}")
# Wait for task completion and show progresstask=awaitclient.wait_for_task(task_id, verbose=True)
iftask.status==TaskStatus.SUCCESS:
print(f"Task completed successfully!")
# Download model filesdownloaded_files=awaitclient.download_task_models(task, "./output")
# Print downloaded file pathsformodel_type, file_pathindownloaded_files.items():
iffile_path:
print(f"Downloaded {model_type}: {file_path}")
asyncio.run(multiview_to_model_example())importasynciofromtripo3dimportTripoClientasyncdefcheck_balance():
asyncwithTripoClient() asclient:
balance=awaitclient.get_balance()
print(f"Available balance: {balance.balance}")
print(f"Frozen amount: {balance.frozen}")
asyncio.run(check_balance())For more advanced usage examples, check out the examples directory.
The complete API documentation can be found here.
MIT