# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"43": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/Tripo_3.1",
"mesh": [
"47",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"44": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"45": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_side_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"46": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_back_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"47": {
"class_type": "TripoMultiviewToModelNode",
"inputs": {
"auto_size": False,
"face_limit": -1,
"geometry_quality": "standard",
"image": [
"44",
0
],
"image_back": [
"46",
0
],
"image_left": [
"45",
0
],
"model_seed": 42,
"model_version": "v3.1-20260211",
"orientation": "default",
"pbr": True,
"quad": False,
"smart_low_poly": False,
"texture": True,
"texture_alignment": "original_image",
"texture_quality": "standard",
"texture_seed": 42
},
"_meta": {
"title": "Tripo: Multiview to Model"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("44", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
workflow.set_input("46", "image", client.assets.from_url("https://example.com/replace-with-a-url/image_back"))
workflow.set_input("45", "image", client.assets.from_url("https://example.com/replace-with-a-url/image_side"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)