mirror of
https://github.com/Comfy-Org/comfy-swift-sdk.git
synced 2026-11-04 23:47:26 +00:00
[PR #80] [MERGED] feat: add model_provider / strict_mode / fallback_provider to model run #81
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-swift-sdk#81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-swift-sdk/pull/80
Author: @deepme987
Created: 9/17/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @mattmillerai
Base:
main← Head:deepme987/router-provider-params📝 Commits (4)
32b942cchore: sync vendored Comfy Router spec from cloud@996a63c4b2fd24feat: add model_provider / strict_mode / fallback_provider to model run67f76a6test(router): add live e2e for model run alt-provider controls1c26dbefix(router): apply review feedback on the alt-provider run parameters📊 Changes
8 files changed (+1086 additions, -47 deletions)
View changed files
📝
README.md(+2 -0)📝
Sources/ComfySwiftSDK/Internal/RouterTransport.swift(+130 -2)📝
Sources/ComfySwiftSDK/Public/RouterError.swift(+28 -3)📝
Sources/ComfySwiftSDK/Public/RouterModels.swift(+56 -1)📝
Tests/ComfySwiftSDKTests/RouterErrorMappingTests.swift(+10 -6)➕
Tests/ComfySwiftSDKTests/RouterModelsE2ETests.swift(+174 -0)📝
Tests/ComfySwiftSDKTests/RouterRunTests.swift(+291 -0)📝
spec/router-openapi.yaml(+395 -35)📄 Description
What
Adds Comfy Router alt-provider controls to
client.models.run, mirroring comfy-python-sdk#159. Three optional parameters, each sent as a query parameter on the run route and only when set, so a call that names none posts to byte-for-byte the URL this route has always used:modelProvider: String?wiresmodel_provider— an alternate serving provider (e.g."fal"); omitted serves the model on its default provider.strictMode: Bool?wiresstrict_modeas the literaltrue/false.false(the server default) has Router translate between the model's native contract and the alternate provider's real schema in both directions;truesends and returns the provider's own raw shape unchanged.fallbackProvider: String?wiresfallback_provider. On by default; pass"false"to opt out of the retry against the model's other registered provider.Query values are percent-encoded per value (sub-delimiters
&=+?escaped), so a value can never reshape the query string. The query is fixed once and reused on every collect re-send, exactly like the request body, so a same-key re-send stays the same logical request.Also reconciles the closed
RouterErrorTypeset with the vendored spec that this branch carries (cloud@996a63c): addscancelled,queue_timeout, andrequest_not_found(15 -> 18 buckets), keepingScripts/contract/check_router_contract.pyand its swift-side twinRouterErrorMappingTestsgreen.Scope
Run route only (
POST /v2/models/{provider}/{model}). Not submit / subscribe / queue — the backend rejects these parameters there.This branch is stacked on the vendored-spec sync (#79) so the error-taxonomy reconciliation is checked against a spec that already declares the new buckets. Land #79 first, or land this (it carries that sync commit). The three feature parameters are defined in
components.parametersof that synced spec (ModelProvider,StrictMode,FallbackProvider).Testing
swift build— clean.swift test --no-parallel— 380 tests, all passing, including new coverage for: omitted params leaving the URL query-free, each param wired to its contract name,strict_modeas a literal bool, thefallback_provider=falseopt-out, all three together, the query surviving a collect re-send identically, reserved-character percent-encoding, and a directRouterTransport.runQueryunit test.python3 Scripts/contract/check_router_contract.py—OK: 18 error types, POST https://api.comfy.org/v2/models/{provider}/{model} bound.No live API calls were made.
Companion PRs
model_provider/strict_mode/fallback_providerto model run)model_provider/strict_mode/fallback_providerto model run)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.