Repository navigation
Conversation
New bundled plugin extensions/huggingface-extras/ that registers an image generation provider against the Hugging Face Inference API. Phase 1 only: text-to-image via /models/<id>, default model FLUX.1-schnell, supports size, aspectRatio, and resolution. Phases 2 and 3 will add embeddings and speech contracts against the same provider id. Complements the chat-only huggingface plugin which routes through the HF Inference Providers OpenAI-compatible router.
Fix tsgo errors: - resolveApiKeyForProvider param is named 'store' not 'authStore' - the function returns ResolvedProviderAuth, extract .apiKey Apply oxfmt formatting.
The legacy api-inference.huggingface.co host was retired in favor of the Inference Providers router. The hf-inference route at https://router.huggingface.co/hf-inference/models/<id> is the closest drop-in replacement and stays free for HF Pro users; the request body shape (inputs + parameters) and the raw image binary response are unchanged, so only the base URL needs to move. Verified locally with FLUX.1-schnell returning a 1024x1024 image.
Adds two more contracts to the huggingface-extras plugin so HF Pro users
get a single provider id covering image generation, memory embeddings, and
audio transcription:
- embeddings-provider.ts: MemoryEmbeddingProviderAdapter routing through
Scaleway's OpenAI-compatible /v1/embeddings endpoint with default model
qwen3-embedding-8b. Supports batch and query, returns 4096-dim vectors.
- stt-provider.ts: MediaUnderstandingProvider whose transcribeAudio() POSTs
raw audio bytes to the hf-inference whisper-large-v3 model. We cannot
reuse transcribeOpenAiCompatibleAudio() because the HF router does not
expose /v1/audio/transcriptions on this route.
- index.ts: register both new contracts alongside the existing image gen
provider; same auth profile.
- openclaw.plugin.json: declare memoryEmbeddingProviders and
mediaUnderstandingProviders contracts.
- api.ts: re-export the new SDK types and add the Scaleway base URL.
Verified locally:
- Plugin loads without error after restart.
- memorySearch.provider switched to huggingface-extras, full reindex of
52 files / 243 chunks via Scaleway succeeds, search returns matches.
- whisper-large-v3 endpoint returns 200 + {text:...} (probed via curl).
Adds the fourth contract to huggingface-extras: text-to-video routed through
the HF Inference Providers replicate backend. fal-ai is intentionally not
used because it requires pre-paid credits outside the HF Pro $2 monthly tier.
Implementation:
- video-generation-provider.ts builds a VideoGenerationProvider whose
generateVideo() resolves the HF model id to a replicate providerId via a
bundled mapping (Wan family) plus a runtime fallback that calls the public
HF Hub /api/models/{id}?expand[]=inferenceProviderMapping endpoint.
- POSTs to https://router.huggingface.co/replicate/v1/models/{providerId}/predictions
and polls /v1/predictions/{id} every 3s until status=succeeded, then
downloads the output URL as raw mp4 bytes.
- For models without a live replicate route (HunyuanVideo, mochi-1-preview,
CogVideoX, LongCat, LTX-Video and similar fal-ai-only entries), the
resolver throws a clear warning that lists the four supported Wan models
the user can actually run today and explains that fal-ai requires
pre-paid credits.
- Mapping cache is module-level (cleared on restart) to mirror the upstream
HF JS SDK behavior.
Default model: Wan-AI/Wan2.1-T2V-14B. Other live models in the bundled
mapping: Wan2.1-T2V-1.3B, Wan2.2-T2V-A14B, Wan2.2-TI2V-5B.
Contributor
|
Thanks @lyfuci. I’m going to close this draft rather than try to land it in its current form. Main blockers:
Suggested path: reopen as one smaller PR for one capability, probably against the existing I did not treat the branch build failure as a primary blocker because the branch is old and CI is skipped while draft; the items above are enough to block landing independently. |
Closed
4 tasks done
Contributor
Author
|
Superseded by #72129 — much smaller scope (text-to-image only, bundled into the existing |
lyfuci
added a commit
to lyfuci/openclaw
that referenced
this pull request
Jun 23, 2026
Adds image generation to the existing huggingface plugin (instead of introducing a second plugin id), wired through the SDK's guarded provider HTTP helpers so SSRF/proxy/timeout/dispatcher policy stays consistent with the rest of the provider transport layer. isConfigured now resolves the real auth state via isProviderApiKeyConfigured rather than always reporting configured. Out of scope for this change: image-to-image, edit, batches, video, embeddings, STT, and Inference Providers routes other than hf-inference. Those can each follow as their own focused PR. Refs openclaw#63487
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.
Summary
Adds a new bundled plugin
extensions/huggingface-extras/that wires four contracts onto a singlehuggingface-extrasprovider id:router/hf-inference/models/<id>black-forest-labs/FLUX.1-schnellrouter/scaleway/v1/embeddingsqwen3-embedding-8brouter/hf-inference/models/<id>openai/whisper-large-v3router/replicate/v1/models/<providerId>/predictionsWan-AI/Wan2.1-T2V-14BAll four share one HF token (`HUGGINGFACE_HUB_TOKEN` / `HF_TOKEN`) and one onboarding choice. The plugin is `enabledByDefault: false`.
Why this is useful
Hugging Face hosts an enormous catalog of community models, and the Inference Providers router exposes a lot of them through one consistent HTTP surface. Today an openclaw user who wants image generation, embeddings, or STT has to configure a separate provider account (fal-ai, voyage, ElevenLabs, etc.) for each capability. With this plugin, a single HF token unlocks all four task types and the user can experiment with hundreds of models by just changing a model id in `openclaw.json`.
The HF Pro $2 / month free tier covers all four routes used here, so the plugin is also a low-friction way to get started without spinning up a local Ollama or paying multiple vendors.
Open question for reviewers
Would you prefer this to be merged into the existing `extensions/huggingface/` plugin instead, exposing all four contracts under the single `huggingface` provider id?
We took the view that these contracts deserve their own plugin so:
But if the maintainers prefer a single `huggingface` provider id covering everything, happy to refactor — the current split is just what we found cleanest, not a strong opinion. Related issue: #11353.
Implementation notes
Test plan
Known limitations / future work