[PR #142] [MERGED] feat(assets): add Asset.get_download_url and document Router image-to-image #142

Closed
opened 2026-10-31 22:01:44 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/comfy-python-sdk/pull/142
Author: @robinjhuang
Created: 9/10/2026
Status: ✅ Merged
Merged: 9/10/2026
Merged by: @mattmillerai

Base: main ← Head: claude/pensive-bell-5db52q


📝 Commits (3)

  • 03c84bb feat(assets): add Asset.get_download_url and document Router image-to-image
  • f3b57fc fix: address bot review comments
  • 88f50e9 Merge remote-tracking branch 'origin/main' into claude/pensive-bell-5db52q

📊 Changes

4 files changed (+161 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+12 -0)
📝 README.md (+62 -0)
📝 src/comfy_sdk/assets.py (+37 -0)
📝 tests/test_assets.py (+50 -1)

📄 Description

What

An image-to-image call through Comfy Router needs the input image in the form the model's native schema takes. For URL-taking models (e.g. wan/wan2.5-i2i-preview's input.images) that means a URL the provider can fetch, which a local file doesn't have. Uploaded assets already resolve one server-side (the same GET /api/v2/assets/{id}/content endpoint outputs use), but the public Asset handle never exposed it — Output.get_download_url() existed, Asset had nothing.

  • Asset.get_download_url() / AsyncAsset.get_download_url(): commits the asset if needed (hash → dedup probe → upload), then resolves the same DownloadUrl an Output returns — a short-lived, self-authorizing signed URL on Cloud/serverless, or the auth-guarded content endpoint (with expires_at=None) on self-hosted.
  • README: new "Image to image — upload an asset first" section showing upload → get_download_url() → models.run with a URL-taking model, the base64-inline alternative for models like bfl/flux-2-pro, and a pointer from the assets section.
  • Tests: commit-on-demand behavior plus both URL shapes (Cloud redirect with parsed expiry, self-hosted inline with no expiry), sync and async.
  • CHANGELOG: entry under Unreleased.

Why

There was no documented (or possible, without reaching into comfy_low) way to feed a local image to a Router image-to-image model. A matching docs.comfy.org page and a mirror change in the TypeScript SDK (Asset.getDownloadUrl()) are in flight; the docs page's Python snippet depends on the release that carries this.

Validation

Full local CI suite green: ruff check, ruff format --check, mypy src, pytest (721 passed, 4 skipped), and check_public_repo_hygiene.py.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WLwhWvHT34Df3199cAAooJ


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added synchronous and asynchronous methods for retrieving download URLs for uploaded assets.
    • Download URLs include expiration details and support signed URLs.
    • Assets are automatically committed before a URL is generated when needed.
    • Added support for asset-based image-to-image workflows, including URL and inline image inputs.
  • Documentation

    • Added examples covering asset downloads, URL lifetimes, self-hosted usage, and model input schemas.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/comfy-python-sdk/pull/142 **Author:** [@robinjhuang](https://github.com/robinjhuang) **Created:** 9/10/2026 **Status:** ✅ Merged **Merged:** 9/10/2026 **Merged by:** [@mattmillerai](https://github.com/mattmillerai) **Base:** `main` ← **Head:** `claude/pensive-bell-5db52q` --- ### 📝 Commits (3) - [`03c84bb`](https://github.com/Comfy-Org/comfy-python-sdk/commit/03c84bb5ece6f3f4b9d98c72bfd6abcc5720c4b1) feat(assets): add Asset.get_download_url and document Router image-to-image - [`f3b57fc`](https://github.com/Comfy-Org/comfy-python-sdk/commit/f3b57fcc408d4f7ee5d3d10dbd762d707c85c298) fix: address bot review comments - [`88f50e9`](https://github.com/Comfy-Org/comfy-python-sdk/commit/88f50e9a5a92ff5be9f98b149a497b9bfcf2a3d6) Merge remote-tracking branch 'origin/main' into claude/pensive-bell-5db52q ### 📊 Changes **4 files changed** (+161 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+12 -0) 📝 `README.md` (+62 -0) 📝 `src/comfy_sdk/assets.py` (+37 -0) 📝 `tests/test_assets.py` (+50 -1) </details> ### 📄 Description ## What An image-to-image call through Comfy Router needs the input image in the form the model's native schema takes. For URL-taking models (e.g. `wan/wan2.5-i2i-preview`'s `input.images`) that means a URL the provider can fetch, which a local file doesn't have. Uploaded assets already resolve one server-side (the same `GET /api/v2/assets/{id}/content` endpoint outputs use), but the public `Asset` handle never exposed it — `Output.get_download_url()` existed, `Asset` had nothing. - **`Asset.get_download_url()` / `AsyncAsset.get_download_url()`**: commits the asset if needed (hash → dedup probe → upload), then resolves the same `DownloadUrl` an `Output` returns — a short-lived, self-authorizing signed URL on Cloud/serverless, or the auth-guarded content endpoint (with `expires_at=None`) on self-hosted. - **README**: new "Image to image — upload an asset first" section showing upload → `get_download_url()` → `models.run` with a URL-taking model, the base64-inline alternative for models like `bfl/flux-2-pro`, and a pointer from the assets section. - **Tests**: commit-on-demand behavior plus both URL shapes (Cloud redirect with parsed expiry, self-hosted inline with no expiry), sync and async. - **CHANGELOG**: entry under Unreleased. ## Why There was no documented (or possible, without reaching into `comfy_low`) way to feed a local image to a Router image-to-image model. A matching docs.comfy.org page and a mirror change in the TypeScript SDK (`Asset.getDownloadUrl()`) are in flight; the docs page's Python snippet depends on the release that carries this. ## Validation Full local CI suite green: `ruff check`, `ruff format --check`, `mypy src`, `pytest` (721 passed, 4 skipped), and `check_public_repo_hygiene.py`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WLwhWvHT34Df3199cAAooJ --- _Generated by [Claude Code](https://claude.ai/code/session_01WLwhWvHT34Df3199cAAooJ)_ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added synchronous and asynchronous methods for retrieving download URLs for uploaded assets. * Download URLs include expiration details and support signed URLs. * Assets are automatically committed before a URL is generated when needed. * Added support for asset-based image-to-image workflows, including URL and inline image inputs. * **Documentation** * Added examples covering asset downloads, URL lifetimes, self-hosted usage, and model input schemas. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 22:01:44 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-python-sdk#142
No description provided.