Tripo Python Client
Project description
Tripo Python Client
This is a Python client for the Tripo API.
Installation
pip install tripo
export TRIPO_API_KEY="your_api_key"
Usage
This first example is to get the balance.
from tripo import Client
with Client() as client:
balance = client.get_balance()
print(f"Balance: {balance.balance}, Frozen: {balance.frozen}")
This example is to generate a model from text.
import time
from tripo import Client
# Initialize the client
with Client() as client:
# Create a task to generate a model from text
success_task = client.text_to_model(
prompt="A 3D model of a futuristic car",
model_version="v2.0-20240919",
texture=True,
pbr=True
)
print(f"Created task with ID: {success_task.task_id}")
# Get 3d model
print("Waiting for the model to be ready...")
while True:
data = client.try_download_model(success_task.task_id)
if data is not None:
data.save("model.glb")
break
time.sleep(1)
This is the 3D model generated by the previous example.
The next example is to generate a model from an image.
import time
from tripo import Client
# Initialize the client
with Client() as client:
# Upload a file
upload_data = client.upload_file('path/to/your/image.jpg')
print(f"Uploaded file token: {upload_data.image_token}")
# Create a task to generate a model from an image
success_task = client.image_to_model(
file_token=upload_data.image_token,
model_version='v1.4-20240625',
texture=True,
pbr=True
)
print(f"Created task with ID: {success_task.task_id}")
# Get 3d model
print("Waiting for the model to be ready...")
while True:
data = client.try_download_model(success_task.task_id)
if data is not None:
data.save("model.glb")
break
time.sleep(1)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tripo-0.1.4.tar.gz
(1.0 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tripo-0.1.4-py3-none-any.whl
(5.3 kB
view details)
File details
Details for the file tripo-0.1.4.tar.gz.
File metadata
- Download URL: tripo-0.1.4.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85a6a9b30046a86d4e8955e35983746e3229d6e78df14e637b51118fab2f87d5
|
|
| MD5 |
b272dc0668721c8e919903f82f53c7fe
|
|
| BLAKE2b-256 |
e01e8f3446f12233f33d02e00cd1298b9257803f7a492e7f4d76fff2e52b1f9b
|
File details
Details for the file tripo-0.1.4-py3-none-any.whl.
File metadata
- Download URL: tripo-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e081ebe752a2b6b8c42569a1c7042297fb70bc04ec362c57a19f652344f17cb4
|
|
| MD5 |
0b4aa6cc89eeedc8fff6288054cd2b31
|
|
| BLAKE2b-256 |
ff9365fbbb6b412ea55ca0a09b396400438e89b5103fac4bf9da0c0c427cac58
|