Skip to content

fix(api-proxy): offer a model hf-inference still serves - #82

Open
rickstaa wants to merge 1 commit into
mainfrom
fix/api-proxy-replace-deprecated-flux
Open

fix(api-proxy): offer a model hf-inference still serves#82
rickstaa wants to merge 1 commit into
mainfrom
fix/api-proxy-replace-deprecated-flux

Conversation

@rickstaa

Copy link
Copy Markdown
Member

livepeer-example/flux-1-schnell is dead. Calling it returns HTTP 410 {"error":"The requested model is deprecated and no longer supported by provider hf-inference"}, so half of what the example advertises fails for anyone who runs it.

There is no same-modality replacement. Hugging Face's model index now lists exactly one text-to-image model on hf-inference (stabilityai/stable-diffusion-3-medium-diffusers, the one this example already uses). FLUX.1 schnell is still live on nscale, together, fal-ai and wavespeed, but each of those either puts the model in the request body (/v1/images/generations, so nginx can no longer pin it and the operator's token stops being spendable on exactly one model) or answers with a URL rather than the image, and they bill inference-provider credits rather than running on the free provider. Video is worse: hf-inference serves no text-to-video model at all, and every provider that does runs it as an async job, which a stock nginx cannot poll without becoming app code.

So the second capability stays in the image domain by reversing direction: google/vit-base-patch16-224 reads an image instead of making one. It keeps every property the example teaches — the model pinned in the URL, the caller's {"inputs": ...} body forwarded verbatim, hf-inference as the provider — and the price gap is real rather than decorative: one forward pass against a diffusion run, priced at 0.00001 against 0.0001. It also demonstrates itself, since the image SD3 paints is the image ViT reads back.

One wrinkle worth reviewing

call_runner accepts a JSON object or opaque bytes, and raises Live runner call expected JSON object, got list on anything else. Every Hugging Face inference task other than text-to-image answers with a bare JSON array, so this is not specific to ViT — it is what any config-only proxy hits in front of that API. A runner that is pure config can pin, inject, and relabel but cannot rewrite a body, so the route relabels the response Content-Type as text and the client parses it. The README says so in as many words, and the constraint is arguably worth teaching. If we would rather the SDK accepted a top-level array, that is a separate change and this route would drop the relabel.

Testing

Both paths, both capabilities:

  • Offchain — SD3 wrote the JPEG, ViT answered llama at 0.9937 on that same file.
  • On-chain (paid, arbitrum-one-mainnet) — both calls paid and accounted, fee=52781032608 for SD3 and fee=5278103260 for ViT, the 10x the config asks for. MAX_PRICE_PER_UNIT is unchanged and still clears the highest price.

Also updated: the root README transport column, the app README throughout, and the .env.example note that named flux as the cheaper capability.

hf-inference dropped FLUX.1 schnell (410, "deprecated and no longer
supported by provider"), and it now serves exactly one text-to-image
model, so the second capability cannot be another painter. ViT keeps it
in the same domain by reading an image instead of making one: same
pinned URL, same {"inputs": ...} body, a tenth of the price, and it
classifies what SD3 just painted.

A bare JSON array is neither a JSON object nor opaque bytes, so the
route relabels the response as text for the client to parse.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 18, 2026 09:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants