feat: add on-demand format conversion support (FBX, STL, USDZ, MP4, GIF)

- Discover /creations/resourceConvert endpoint via browser inspection
- Add resource_convert() method to api.py and api_complete.py
- Extend MODEL_FORMAT_KEYS with fbx, stl, usdz, mp4, gif
- Update get_model_urls() and download_model() with include_converted flag
- Update CLI with --converted flag for formats and download commands
- Update reverse engineering docs with native vs converted format tables
This commit is contained in:
KawasakiAkasei
2026-05-27 13:42:29 +08:00
parent ad3c86b8ba
commit 5328c213fe
5 changed files with 181 additions and 14 deletions

View File

@@ -137,8 +137,14 @@ result = api.generate_from_image(resource_url, title="My Model")
# List available formats for a creation
hunyuan3dweb formats <creation_id>
# Include converted formats (fbx, stl, usdz, mp4, gif)
hunyuan3dweb formats <creation_id> --converted
# Download a specific format (default: glb)
hunyuan3dweb download <creation_id> --format glb -o model.glb
# Download a converted format
hunyuan3dweb download <creation_id> --format usdz --converted -o model.usdz
```
---
@@ -154,6 +160,7 @@ hunyuan3dweb download <creation_id> --format glb -o model.glb
| Creation list | POST | `/creations/list` | Query params |
| Creation count | POST | `/creations/count` | Query params |
| Cancel generation | POST | `/creations/cancel` | Query params |
| Resource convert | POST | `/creations/resourceConvert` | Query params |
| Upload credentials | POST | `/resource/genUploadInfo` | Query params |
| Resource review | POST | `/resource/review` | Query params |
| Create share | POST | `/share` | Query params |
@@ -162,7 +169,9 @@ hunyuan3dweb download <creation_id> --format glb -o model.glb
### Model Download Formats
The `urlResult` field in `/creations/detail` contains up to 14 format keys:
#### Native Formats (from `urlResult`)
The `urlResult` field in `/creations/detail` contains up to 14 native format keys:
| Key | Description |
|-----|-------------|
@@ -181,6 +190,28 @@ The `urlResult` field in `/creations/detail` contains up to 14 format keys:
| `invisible_wall` | Invisible collision wall |
| `air_wall` | Air wall (collision body) |
#### Converted Formats (via `/creations/resourceConvert`)
Additional formats are generated on-demand by converting the OBJ zip:
| Key | Description | Source |
|-----|-------------|--------|
| `fbx` | Autodesk FBX format | OBJ zip conversion |
| `stl` | STL format (3D printing) | OBJ zip conversion |
| `usdz` | USDZ format (iOS AR Quick Look) | OBJ zip conversion |
| `mp4` | MP4 video format | OBJ zip conversion |
| `gif` | GIF animation format | OBJ zip conversion |
**Conversion API**:
```python
POST /creations/resourceConvert
Body: {
"sourceResource": [{"format": "zip", "url": "<obj_zip_url>"}],
"targetFormatList": ["usdz", "fbx"]
}
Response: {"convertResult": [{"format": "usdz", "url": "..."}]}
```
---
## Technical Details