Repository navigation
models: Hugging Face's open models, offered with HF_TOKEN - #12
Merged
Merged
Conversation
Kimi K3, GLM 5.3, DeepSeek V4.1 Flash and Qwen3.8 27B through Hugging Face's Inference Providers router (OpenAI-compatible chat completions, @ai-sdk/openai-compatible 3.0.5 — the same provider/provider-utils as ai 7.0.15). Like the gateway's models they are offered only when their key is set: HF_TOKEN as a Worker secret, read per request. Each is served with tool calling by at least two providers on the router. Without the token a request naming one is answered by the default Workers AI model. /api/health reports huggingface connected / not connected; the product README, BOOTSTRAP and operations context say how to turn it on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Adds Hugging Face's Inference Providers as a third model source, beside Workers AI (always on) and the Vercel AI Gateway (with its key).
Models (each served with tool calling by ≥2 providers on
router.huggingface.co/v1/models): Kimi K3 (moonshotai/Kimi-K3), GLM 5.3 (zai-org/GLM-5.3), DeepSeek V4.1 Flash (deepseek-ai/DeepSeek-V4.1-Flash), Qwen3.8 27B (Qwen/Qwen3.8-27B).How:
lib/ai/models.ts:huggingFaceModels(via: "huggingface", capabilities known locally),isHuggingFaceConfigured()readsHF_TOKENper request;getAvailableModels()adds them only with the token.lib/ai/providers.ts:createOpenAICompatibleagainsthttps://router.huggingface.co/v1,HF_TOKENas the bearer, built per call. A Hugging Face model with no token falls back to the default Workers AI model, like a gateway model with no key.@ai-sdk/openai-compatible@3.0.5: the same@ai-sdk/provider@4.0.2/provider-utils@5.0.5asai@7.0.15; the lockfile gains only that package./api/health:models.huggingfaceconnected / not connected.ai/context/operations.md,.env.example,.dev.vars.example, wrangler comments.To turn it on in a product: a Hugging Face token with "Make calls to Inference Providers", then
wrangler secret put HF_TOKEN --name <reponame>-web-<env>.Tests:
tests/web51 passed (new: offered only with the token, capabilities without a network call, no-token fallback, a call through the router with the bearer and model id).apps/webtypecheck and ultracite clean.🤖 Generated with Claude Code