Update: I have deployed a ready-to-use endpoint url on a cloud 3060 GPU and the low-vram mode. You can use that if you just want to have a try. Otherwise it's better to deploy by yourself.
- Python 3.8+
- Redis server
- CUDA-capable GPU (recommended)
- Clone the repository:
git clone https://github.com/FishWoWater/TRELLIS.git
cd TRELLIS
- Install Python dependencies:
# install requirements according to offical repo
. ./setup.sh --new-env --basic --xformers --flash-attn --diffoctreerast --spconv --mipgaussian --kaolin --nvdiffrast
# requirements for the API
pip install flask flask_cors open3d redis gunicorn
python api.py
- Install and start Redis server:
# Ubuntu/Debian
sudo apt-get install redis-server
sudo systemctl start redis-server
# MacOS
brew install redis
brew services start redis
- Start the API server:
# for development mode (uses GPU 0)
python api.py
# for production mode (automatically uses all available GPUs)
gunicorn -c gunicorn_config.py wsgi:app
The server will run on port 6006 by default. In production mode, it will automatically detect the number of available GPUs and create one worker per GPU for optimal resource utilization.
Endpoint: /image_to_3d
Method: POST
Content-Type: multipart/form-data
Parameters:
image
(file, required): Input image filesparse_structure_sample_steps
(int, optional): Number of sampling steps for sparse structure generation (default: 25)sparse_structure_cfg_strength
(float, optional): Guidance strength for sparse structure (default: 8.5)slat_sample_steps
(int, optional): Number of sampling steps for structured latent (default: 25)slat_cfg_strength
(float, optional): Guidance strength for structured latent (default: 4.0)simplify_ratio
(float, optional): Mesh simplification ratio (default: 1.0)texture_size
(int, optional): Size of generated texture (default: 1024)texture_bake_mode
(str, optional): Mode for texture baking (default: "pbr")
Response:
{
"request_id": "string",
"status": "queued"
}
Endpoint: /my_requests
Method: GET
Response:
{
"requests": [
{
"request_id": "string",
"status": "string", // "queued", "processing", "complete", or "error"
"image_name": "string",
"output_files": ["string"], // Only present if status is "complete"
"error": "string" // Only present if status is "error"
}
]
}
Endpoint: /queue/status
Method: GET
Parameters:
request_id
(string, optional): Get status of specific request
Response:
{
"queue_length": "int",
"processing": "int",
"client_queue_length": "int",
"client_processing": "int"
}
Endpoint: /outputs/<ip_address>/<request_id>/<filename>
Method: GET
Downloads a specific output file from a completed request.
The API uses standard HTTP status codes:
- 200: Success
- 400: Bad Request (invalid parameters)
- 404: Not Found
- 500: Internal Server Error
Error responses include a message explaining the error:
{
"error": "Error message"
}
- Each IP address is limited to 10 recent requests in history
- Requests are processed in a FIFO queue
- The server maintains separate output directories for each IP address
- The API uses Redis for request queue management
- All requests are processed asynchronously
- Output files are stored in IP-specific directories
- The server supports both CPU and GPU processing (GPU recommended)