# 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": "RecraftTextToVectorNode",
"inputs": {
"n": 1,
"negative_prompt": "",
"prompt": "A magical academy crest design, featuring a central emblem of a mystical creature, such as a dragon or phoenix, surrounded by arcane symbols, ancient runes, and magical elements. The design should be intricate and ornate, with multiple layers of detail. Incorporate a variety of vibrant colors like deep blues, purples, golds, and silvers, to represent different magical elements like fire, water, and air. The emblem should have a shield-like structure with flowing ribbons, stars, and enchanted accents. The overall style should be grand and regal, evoking a sense of mysticism and wisdom, suitable for a prestigious magical institution.",
"seed": 0,
"size": "1024x1024",
"substyle": "None"
},
"_meta": {
"title": "Recraft V3 Text to Vector"
}
},
"33": {
"class_type": "SaveSVGNode",
"inputs": {
"filename_prefix": "svg/ComfyUI",
"svg": [
"3",
0
]
},
"_meta": {
"title": "Save SVG"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)