[PR #132] [MERGED] feat(assets): add Asset.getDownloadUrl for Router image-to-image inputs #134

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

📋 Pull Request Information

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

Base: main ← Head: claude/asset-get-download-url


📝 Commits (2)

  • 7ba2ae9 feat(assets): add Asset.getDownloadUrl for Router image-to-image inputs
  • 5c6a44b fix: address bot review comments

📊 Changes

4 files changed (+125 additions, -0 deletions)

View changed files

📝 CHANGELOG.md (+12 -0)
📝 README.md (+62 -0)
📝 src/sdk/assets.test.ts (+25 -0)
📝 src/sdk/assets.ts (+26 -0)

📄 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.getDownloadUrl() existed, Asset had nothing.

  • Asset.getDownloadUrl(signal?): commits the asset if needed (hash → dedup probe → upload), then resolves the same { url, expiresAt } an Output resolves to — a short-lived, self-authorizing signed URL on Cloud/serverless, or the auth-guarded content endpoint (with expiresAt: null) on self-hosted. Matches Asset.get_download_url() in the Python SDK (Comfy-Org/comfy-python-sdk#142); the surface-parity check only covers models methods and error classes, so no snapshot change is needed.
  • README: new "Image to image — upload an asset first" section showing upload → getDownloadUrl() → comfy.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 null expiry).
  • CHANGELOG: entry under Unreleased.

Why

There was no documented (or possible, without dropping to the low layer) way to feed a local image to a Router image-to-image model. A matching docs.comfy.org page is in flight; its TypeScript snippet depends on the release that carries this.

Validation

Full local CI suite green: pnpm lint, pnpm format:check, pnpm typecheck, pnpm test (434 passed), pnpm check:spec-drift, check-public-repo-hygiene.mjs, and pnpm build.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WLwhWvHT34Df3199cAAooJ


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Assets now provide fetchable download URLs, including expiration details when applicable.
    • Uncommitted assets are automatically committed before a download URL is returned.
    • Supports image-to-image workflows using uploaded assets with URL-based model inputs or inline base64 data.
  • Documentation

    • Added guidance for asset downloads, image-to-image workflows, model input formats, and self-hosted URL limitations.
    • Documented compatibility with services such as Comfy Router.

🔄 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-typescript-sdk/pull/132 **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/asset-get-download-url` --- ### 📝 Commits (2) - [`7ba2ae9`](https://github.com/Comfy-Org/comfy-typescript-sdk/commit/7ba2ae99e256a14e97209cafded85e9b666f877f) feat(assets): add Asset.getDownloadUrl for Router image-to-image inputs - [`5c6a44b`](https://github.com/Comfy-Org/comfy-typescript-sdk/commit/5c6a44bc6ea51aa94466a379ed9a023b4be4bd13) fix: address bot review comments ### 📊 Changes **4 files changed** (+125 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+12 -0) 📝 `README.md` (+62 -0) 📝 `src/sdk/assets.test.ts` (+25 -0) 📝 `src/sdk/assets.ts` (+26 -0) </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.getDownloadUrl()` existed, `Asset` had nothing. - **`Asset.getDownloadUrl(signal?)`**: commits the asset if needed (hash → dedup probe → upload), then resolves the same `{ url, expiresAt }` an `Output` resolves to — a short-lived, self-authorizing signed URL on Cloud/serverless, or the auth-guarded content endpoint (with `expiresAt: null`) on self-hosted. Matches `Asset.get_download_url()` in the Python SDK (Comfy-Org/comfy-python-sdk#142); the surface-parity check only covers `models` methods and error classes, so no snapshot change is needed. - **README**: new "Image to image — upload an asset first" section showing upload → `getDownloadUrl()` → `comfy.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 null expiry). - **CHANGELOG**: entry under Unreleased. ## Why There was no documented (or possible, without dropping to the low layer) way to feed a local image to a Router image-to-image model. A matching docs.comfy.org page is in flight; its TypeScript snippet depends on the release that carries this. ## Validation Full local CI suite green: `pnpm lint`, `pnpm format:check`, `pnpm typecheck`, `pnpm test` (434 passed), `pnpm check:spec-drift`, `check-public-repo-hygiene.mjs`, and `pnpm build`. 🤖 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** - Assets now provide fetchable download URLs, including expiration details when applicable. - Uncommitted assets are automatically committed before a download URL is returned. - Supports image-to-image workflows using uploaded assets with URL-based model inputs or inline base64 data. - **Documentation** - Added guidance for asset downloads, image-to-image workflows, model input formats, and self-hosted URL limitations. - Documented compatibility with services such as Comfy Router. <!-- 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:04:52 +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-typescript-sdk#134
No description provided.