# 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({
"1": {
"class_type": "TripoImageToModelNode",
"inputs": {
"auto_size": True,
"face_limit": -1,
"geometry_quality": "standard",
"image": [
"19",
0
],
"model_seed": 42,
"model_version": "v3.0-20250812",
"orientation": "default",
"pbr": True,
"quad": False,
"smart_low_poly": False,
"style": "person:person2cartoon",
"texture": True,
"texture_alignment": "geometry",
"texture_quality": "detailed",
"texture_seed": 42
},
"_meta": {
"title": "Tripo: Image to Model (Legacy)"
}
},
"2": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"3": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_3_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"4": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_2_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"12": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"1",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"13": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/tripo_image2model",
"mesh": [
"1",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"19": {
"class_type": "BatchImagesNode",
"inputs": {
"images.image0": [
"2",
0
],
"images.image1": [
"4",
0
],
"images.image2": [
"3",
0
]
},
"_meta": {
"title": "Batch Images"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("2", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
workflow.set_input("4", "image", client.assets.from_url("https://example.com/replace-with-a-url/image_2"))
workflow.set_input("3", "image", client.assets.from_url("https://example.com/replace-with-a-url/image_3"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)