# 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({
"35": {
"class_type": "TripoImageToModelNode",
"inputs": {
"auto_size": True,
"face_limit": -1,
"geometry_quality": "standard",
"image": [
"36",
0
],
"model_seed": 42,
"model_version": "v2.5-20250123",
"orientation": "default",
"pbr": True,
"quad": False,
"smart_low_poly": False,
"style": "None",
"texture": True,
"texture_alignment": "original_image",
"texture_quality": "standard",
"texture_seed": 42
},
"_meta": {
"title": "Tripo: Image to Model (Legacy)"
}
},
"36": {
"class_type": "LoadImage",
"inputs": {
"image": "UPLOADED_image_FILENAME"
},
"_meta": {
"title": "Load Image"
}
},
"51": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"35",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"57": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/tripo_img2model",
"mesh": [
"35",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
}
})
# Replace each example.com URL with a public URL of your file.
workflow.set_input("36", "image", client.assets.from_url("https://example.com/replace-with-a-url/image"))
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)