# 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({
"3": {
"class_type": "TripoTextToModelNode",
"inputs": {
"auto_size": True,
"face_limit": -1,
"geometry_quality": "standard",
"image_seed": 42,
"model_seed": 42,
"model_version": "v2.5-20250123",
"negative_prompt": "",
"pbr": True,
"prompt": "Generate a 3D model of a steampunk-inspired spider drone with brass legs, steam vents, and a camera eye, set in a crouched, ready-to-leap posture.\n",
"quad": False,
"smart_low_poly": False,
"style": "None",
"texture": True,
"texture_quality": "detailed",
"texture_seed": 42
},
"_meta": {
"title": "Tripo: Text to Model (Legacy)"
}
},
"17": {
"class_type": "Preview3D",
"inputs": {
"model_file": [
"3",
0
]
},
"_meta": {
"title": "Preview 3D & Animation (DEPRECATED)"
}
},
"27": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/tripo_text2model",
"mesh": [
"3",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)