Skip to main content

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 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.3.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

tripo-0.1.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file tripo-0.1.3.tar.gz.

File metadata

  • Download URL: tripo-0.1.3.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.24

File hashes

Hashes for tripo-0.1.3.tar.gz
Algorithm Hash digest
SHA256 22286f5928ea8d64630667a114787ff30e0e7d698c5fcd08653dcd82484dfe2a
MD5 300231402a50fc724f4b163b28d38348
BLAKE2b-256 75b4f6a37e37f8cc6a40bf75d97e2864c3290ea9008e21f0268b43d207e444a9

See more details on using hashes here.

File details

Details for the file tripo-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tripo-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.24

File hashes

Hashes for tripo-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 53003d48f960a918d1766352e53e23e2bd03e4f2d962da4cef4c5fefa6616744
MD5 04cbb4287a0a9b2b23f9be4e5eca05fd
BLAKE2b-256 7fc75630c6208c0cd8e33e177220fab6595208dbf7af10b268b386334d30076f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page