| Crates.io | tripo3d |
| lib.rs | tripo3d |
| version | 0.4.0 |
| created_at | 2025-07-09 21:37:00.870113+00 |
| updated_at | 2025-07-10 05:42:07.251001+00 |
| description | An unofficial Rust SDK for the Tripo3D API |
| homepage | https://platform.tripo3d.ai |
| repository | https://github.com/jianglu/tripo-rust-sdk |
| max_upload_size | |
| id | 1745539 |
| size | 372,661 |
An unofficial Rust SDK for the Tripo3d API, providing an easy-to-use interface for 3D model generation.
Add this to your Cargo.toml:
[dependencies]
tripo3d = "0.1.0"
The SDK requires an API key for authentication. You can pass the key directly to the client or set the TRIPO_API_KEY environment variable. You can find your API key on the Tripo3D Platform.
Here's an example of the complete workflow: submitting a task, waiting for it to complete, and downloading the resulting model.
use tripo3d::{TripoClient, TaskState};
use std::env;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Load .env file if it exists.
dotenvy::dotenv().ok();
// Initialize the client from an environment variable.
let client = TripoClient::new(env::var("TRIPO_API_KEY").ok())?;
// 1. Submit a task.
let prompt = "a high quality 3d model of a cat";
println!("Submitting task for prompt: '{}'", prompt);
let task_response = client.text_to_3d(prompt).await?;
println!("Task submitted with ID: {}", task_response.task_id);
// 2. Wait for the task to complete, with verbose progress.
println!("\nWaiting for task to complete...");
let final_status = client
.wait_for_task(&task_response.task_id, true)
.await?;
// 3. Check the final status and download the models if successful.
if final_status.status == TaskState::Success {
println!("\nTask completed successfully!");
let output_dir = "output";
println!("Downloading models to '{}' directory...", output_dir);
match client.download_all_models(&final_status, output_dir).await {
Ok(downloaded_files) => {
if downloaded_files.is_empty() {
println!("No models were generated or downloaded.");
} else {
println!("\nSuccessfully downloaded {} files:", downloaded_files.len());
for path in downloaded_files {
println!("- {}", path.display());
}
}
}
Err(e) => {
eprintln!("\nFailed to download models: {}", e);
}
}
} else {
println!("\nTask failed with status: {}", final_status.status);
}
Ok(())
}
For more detailed examples, please see the examples directory in the repository.
For more detailed information about the API and its features, please refer to the official documentation.
This SDK is licensed under the MIT License. See the LICENSE file for more details.