Repository navigation
Conversation
from_example builds one of three built-in workflows (text-to-image, image-to-video, text-to-video) with named inputs, so a new user can run something before they have a workflow_api.json of their own. check() confirms the key and the address with one authenticated read that runs nothing: a lookup of a job id no deployment issues, whose only healthy answer is 404 job_not_found.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
Contributor
Author
|
Companion TypeScript PR: Comfy-Org/comfy-typescript-sdk#221 (same API, graphs generated from this PR's definitions). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two additions for a developer's first five minutes with the SDK:
client.workflows.from_example(name, **inputs)builds one of three built-in workflows:text-to-image(Z-Image Turbo),image-to-videoandtext-to-video(Wan 2.2 5B). Inputs have names (prompt,seed,image,width, ...), so nobody has to know node ids.client.workflows.examples()lists them all.client.check()(sync and async) confirms the key and the address without running anything. It returnsCheckResult(base_url, authenticated), raisesUnauthorizedfor a rejected key, and raisesComfyError(code="not_a_comfy_api")whenCOMFY_BASE_URLpoints at something that isn't a v2 deployment.Why
Today the first thing a new user is told to run is
client.workflows.from_file("workflow_api.json"). They don't have that file, so the snippet fails locally before it reaches us. With this change the copy-paste snippet can run without any changes:How
check()worksThere's no whoami or balance route in the v2 contract.
check()looks up the job id00000000-0000-0000-0000-000000000000:404 job_not_found.It works the same on Cloud, serverless and the self-hosted proxy. It doesn't check balance or subscription. That needs a server route.
Verified live on Comfy Cloud
check()with a valid keyCheckResult(base_url='https://cloud.comfy.org', authenticated=True)in 0.26scheck()with a bogus keyUnauthorizedtext-to-imageimage-to-video(fed the PNG above)text-to-videoNote:
run()on Cloud currently fails at the first poll for every SDK version. Cloud returnshttp://follow-up URLs, and the SDK correctly won't send the key there. The fix is server-side and in review. The live runs above simulated that fix by rewriting the URLs in the test harness. This PR changes nothing about follow-up URLs.Tests
tests/test_check.py: pass, keyless, rejected key, bare 404, web page, a 200 job for the probe id, 5xx passthrough, and the key never appearing in the result. Each runs on both sync and async.tests/test_examples.py: every input lands on an existing node and field, every link resolves, each example ends in the right save node, plus naming, defaults, seed randomness, template immutability, error messages, and submit through the stub.Companion: the same API in the TypeScript SDK (linked below once open).