# 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({
"7": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/api_meshy7_text_to_model",
"mesh": [
"9",
2
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"8": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/api_meshy7_text_to_model_from_fbx",
"mesh": [
"9",
3
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"9": {
"class_type": "MeshyTextToModelNode",
"inputs": {
"model": "meshy-7",
"pose_mode": "",
"prompt": "Anubis, jackal-headed god of the dead, full body, black obsidian body with gold trim, ornate ankh staff, stylized Egyptian mythology, low poly, t-pose",
"seed": 1548939181,
"should_remesh": "true",
"should_remesh.target_polycount": 300000,
"should_remesh.topology": "triangle",
"style": "realistic",
"symmetry_mode": "auto",
"ultra_mode": False,
"ultra_resolution": "2k"
},
"_meta": {
"title": "Meshy: Text to Model"
}
},
"11": {
"class_type": "SaveText",
"inputs": {
"filename_prefix": "meshy_model_path_%year%%month%%day%_%hour%%minute%",
"format": "txt",
"text": [
"9",
0
]
},
"_meta": {
"title": "Save Text"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)