Skip to main content

Python client for the Tripo 3D Generation API

Project description

Tripo3d Python SDK

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.

Features

  • Text-to-3D model generation
  • Image-to-3D model generation
  • Multi-view to 3D model generation
  • Mesh Editing including mesh segmentation, mesh completion and smart lowpoly
  • Model conversion and stylization
  • Rigging and retarget
  • Asynchronous API support
  • Complete type hints
  • Simple and easy-to-use interface

Installation

pip install tripo3d

Quick Start

Initialization

import asyncio
from tripo3d import TripoClient

async def main():
    # Initialize client with API key
    client = 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 connection
    await client.close()

# Run async function
asyncio.run(main())

Text to 3D Model

import asyncio
from tripo3d import TripoClient

async def text_to_model_example():
    async with TripoClient() as client:
        # Create text to 3D model task
        task_id = await client.text_to_model(
            prompt="A cute cat",
            negative_prompt="low quality, blurry",
        )

        print(f"Task ID: {task_id}")

        # Wait for task completion
        task = await client.wait_for_task(task_id)

        if task.status == TaskStatus.SUCCESS:
            print(f"Task completed successfully!")

            # Download model files
            downloaded_files = await client.download_task_models(task, "./output")

            # Print downloaded file paths
            for model_type, file_path in downloaded_files.items():
                if file_path:
                    print(f"Downloaded {model_type}: {file_path}")

asyncio.run(text_to_model_example())

Image to 3D Model

import asyncio
from tripo3d import TripoClient

async def image_to_model_example():
    async with TripoClient() as client:
        # Create image to 3D model task
        task_id = await client.image_to_model(
            image="path/to/your/image.jpg",
        )

        print(f"Task ID: {task_id}")

        # Wait for task completion and show progress
        task = await client.wait_for_task(task_id, verbose=True)

        if task.status == TaskStatus.SUCCESS:
            print(f"Task completed successfully!")

            # Download model files
            downloaded_files = await client.download_task_models(task, "./output")

            # Print downloaded file paths
            for model_type, file_path in downloaded_files.items():
                if file_path:
                    print(f"Downloaded {model_type}: {file_path}")

asyncio.run(image_to_model_example())

Multi-view to 3D Model

import asyncio
from tripo3d import TripoClient

async def multiview_to_model_example():
    async with TripoClient() as client:
        # Create multi-view to 3D model task
        task_id = await client.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 progress
        task = await client.wait_for_task(task_id, verbose=True)

        if task.status == TaskStatus.SUCCESS:
            print(f"Task completed successfully!")

            # Download model files
            downloaded_files = await client.download_task_models(task, "./output")

            # Print downloaded file paths
            for model_type, file_path in downloaded_files.items():
                if file_path:
                    print(f"Downloaded {model_type}: {file_path}")

asyncio.run(multiview_to_model_example())

Check Account Balance

import asyncio
from tripo3d import TripoClient

async def check_balance():
    async with TripoClient() as client:
        balance = await client.get_balance()
        print(f"Available balance: {balance.balance}")
        print(f"Frozen amount: {balance.frozen}")

asyncio.run(check_balance())

Advanced Usage

For more advanced usage examples, check out the examples directory.

API Reference

The complete API documentation can be found here.

License

MIT

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

tripo3d-0.3.9.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tripo3d-0.3.9-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file tripo3d-0.3.9.tar.gz.

File metadata

  • Download URL: tripo3d-0.3.9.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tripo3d-0.3.9.tar.gz
Algorithm Hash digest
SHA256 62bfb1099a80baa2d47ed8ba9686a928125035608193cd5f673c5c6b8287ae1e
MD5 b9caea62be59f7472f5b7644e5fd3308
BLAKE2b-256 36ef85c633db43a86e2d5b4ae42be44f0431bd7fa4a7f2e8f431698d5e63a37b

See more details on using hashes here.

File details

Details for the file tripo3d-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: tripo3d-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tripo3d-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 40c02e2f379e6378499986700731535a4b7ea30121257f6e229f01a0b37241e7
MD5 cf8d506acf41c69b6834a58b05e2e209
BLAKE2b-256 95003d3aa98dbbb5c4ebd3a196ccf97e676949d063e5dfed62796ba3118b7a62

See more details on using hashes here.

Supported by

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