edit_flow
Change the STRUCTURE of an existing flow in place: add or remove nodes, swap the model on a node, and connect or disconnect ports. This is the tool for "add an upscaler to this flow", "use a different model here", "rewire this" — do NOT create a new flow to modify one that already exists (update_flow only changes name, tags and node parameters). All operations in one call are applied together: either every one lands or none does. Read the flow with get_flow first to get node IDs, and get_model for port layouts before wiring.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow_id | Yes | The unique identifier of the flow to edit. | |
| operations | Yes | JSON array of operations, applied as one batch. Each entry has an "op" field: - {"op":"add_node","model_id":"SISR-PiSA-SR","parameters":{"steps":30}} — parameters are optional; the new node's ID is assigned by the server and reported back - {"op":"delete_node","node_id":3} — connections to and from the node go with it - {"op":"replace_model","node_id":3,"model_id":"VideoUpscaling-SeedVR2-3B"} — migrates compatible parameters and keeps the edges only when the two models' ports match; the response says whether they were kept - {"op":"connect","out_node_id":3,"out_port_index":0,"in_node_id":4,"in_port_index":0} - {"op":"disconnect","out_node_id":3,"out_port_index":0,"in_node_id":4,"in_port_index":0} Port indices are positions in that model's own input/output list and differ between models — read them from get_model. An input port takes exactly one source, so connect a port that is already wired only after disconnecting it in the same call. |