{"id":23179277,"url":"https://github.com/richinsley/comfy2go","last_synced_at":"2026-01-16T07:39:37.111Z","repository":{"id":189037298,"uuid":"679749252","full_name":"richinsley/comfy2go","owner":"richinsley","description":"A Go-based API that acts as a bridge to the ComfyUI backend","archived":false,"fork":false,"pushed_at":"2025-02-17T19:12:25.000Z","size":52,"stargazers_count":61,"open_issues_count":8,"forks_count":20,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T03:41:50.654Z","etag":null,"topics":["comfyui","go","golang","stable-diffusion"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/richinsley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-17T14:27:40.000Z","updated_at":"2025-03-22T16:52:46.000Z","dependencies_parsed_at":"2023-08-18T00:58:32.438Z","dependency_job_id":"4505ec81-ddcb-4616-b0f1-938405e6ab14","html_url":"https://github.com/richinsley/comfy2go","commit_stats":null,"previous_names":["richinsley/comfy2go"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richinsley%2Fcomfy2go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richinsley%2Fcomfy2go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richinsley%2Fcomfy2go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/richinsley%2Fcomfy2go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/richinsley","download_url":"https://codeload.github.com/richinsley/comfy2go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999860,"owners_count":21031046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comfyui","go","golang","stable-diffusion"],"created_at":"2024-12-18T07:14:19.538Z","updated_at":"2026-01-16T07:39:37.100Z","avatar_url":"https://github.com/richinsley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comfy2go\n\nComfy2go is a Go-based API that acts as a bridge to ComfyUI, a powerful and modular stable diffusion GUI and backend. Designed to alleviate the complexities of working directly with ComfyUI's intricate API, Comfy2go offers a more user-friendly way to access the advanced features and functionalities of ComfyUI.\n\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Installation](#installation)\n- [Usage](#usage)\n\n## Overview\n\nComfy2go allows for developers to harness ComfyUI's powerful features in a more accessible way. Comfy2go is comprised of two main parts:\n\n### GraphAPI\nThe GraphAPI approximates the functionality of ComfyUI's front-end graph-based pipeline.  While it does not allow for creating or editing existing workflows, it does allow for quickly finding, and setting the various inputs of each node in a workflow.\n\n### ClientAPI\nThe ClientAPI interoperates with the ComfyUI backend, offering:\n- Backend system statistics\n- Concurrent access to mulitple instances of ComfyUI\n- Image and mask uploading/downloading\n- Creating and queuing prompts from GraphAPI workflows\n- Managing Queues\n- Retreival of Prompt histories\n- Loading workflows from PNG\n- and quite a bit more\n\n## Installation\nFirst, use 'go get' to install the latest version of the library.\n```bash\ngo get -u github.com/richinsley/comfy2go@latest\n```\nNext, include Comfy2go client (and optionally the graph) APIs in your application:\n```go\nimport \"github.com/richinsley/comfy2go/client\"\nimport \"github.com/richinsley/comfy2go/graphapi\"\n```\n## Usage\nAn **IMPORTANT** note is that Comfy2go works with full ComfyUI workflows, not workflows saved with \"Save (API Format)\"\n\n#### Load a workflow from a png and queue it to a ComfyUI instance\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/richinsley/comfy2go/client\"\n)\n\nfunc main() {\n\tclientaddr := \"127.0.0.1\"\n\tclientport := 8188\n\tpngpath := \"my_cool_workflow.png\"\n\n\t// create a new ComgyGo client\n\tc := client.NewComfyClient(clientaddr, clientport, nil)\n\n\t// the ComgyGo client needs to be in an initialized state before\n\t// we can create and queue graphs\n\tif !c.IsInitialized() {\n\t\tlog.Printf(\"Initialize Client with ID: %s\\n\", c.ClientID())\n\t\terr := c.Init()\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error initializing client:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n\n\t// create a graph from the png file\n\tgraph, _, err := c.NewGraphFromPNGFile(pngpath)\n\tif err != nil {\n\t\tlog.Println(\"Failed to get workflow graph from png file:\", err)\n\t\tos.Exit(1)\n\t}\n\n\t// queue the prompt and get the resulting image\n\titem, err := c.QueuePrompt(graph)\n\tif err != nil {\n\t\tlog.Println(\"Failed to queue prompt:\", err)\n\t\tos.Exit(1)\n\t}\n\n\t// continuously read messages from the QueuedItem until we get the \"stopped\" message type\n\tfor continueLoop := true; continueLoop; {\n\t\tmsg := \u003c-item.Messages\n\t\tswitch msg.Type {\n\t\tcase \"stopped\":\n\t\t\t// if we were stopped for an exception, display the exception message\n\t\t\tqm := msg.ToPromptMessageStopped()\n\t\t\tif qm.Exception != nil {\n\t\t\t\tlog.Println(qm.Exception)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tcontinueLoop = false\n\t\tcase \"data\":\n\t\t\tqm := msg.ToPromptMessageData()\n\t\t\t// data objects have the fields: Filename, Subfolder, Type\n\t\t\t// * Subfolder is the subfolder in the output directory\n\t\t\t// * Type is the type of the image temp/\n\t\t\tfor k, v := range qm.Data {\n\t\t\t\tif k == \"images\" || k == \"gifs\" {\n\t\t\t\t\tfor _, output := range v {\n\t\t\t\t\t\timg_data, err := c.GetImage(output)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Println(\"Failed to get image:\", err)\n\t\t\t\t\t\t\tos.Exit(1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf, err := os.Create(output.Filename)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Println(\"Failed to write image:\", err)\n\t\t\t\t\t\t\tos.Exit(1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tf.Write(*img_data)\n\t\t\t\t\t\tf.Close()\n\t\t\t\t\t\tlog.Println(\"Got image: \", output.Filename)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichinsley%2Fcomfy2go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frichinsley%2Fcomfy2go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frichinsley%2Fcomfy2go/lists"}