Add Hugging Face Inference provider - #215
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add Hugging Face and Featherless AI providers
Add Hugging Face Inference and Featherless.ai providers
Feb 18, 2026
- Removed unnecessary registry-url entries from the release workflow for both Node and Bun setups. - Modified job queue tests to improve assertions on pending job counts, ensuring at least 12 jobs remain pending after submissions, without asserting specific job statuses.
Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
sroussey
force-pushed
the
copilot/add-ai-providers
branch
from
February 18, 2026 18:57
b64b994 to
9037529
Compare
sroussey
marked this pull request as ready for review
February 18, 2026 18:58
Collaborator
|
@copilot remove the featherless related code |
Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Add Hugging Face Inference and Featherless.ai providers
Add Hugging Face Inference provider
Feb 18, 2026
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 the Hugging Face Inference API provider following the existing OpenAI architecture pattern.
Provider
HF Inference (
provider-hf-inference/)@huggingface/inferenceSDK (InferenceClient)providerfield routes to specific HF inference backends (fal-ai, fireworks-ai)provider_config.api_keyorHF_TOKENenv varStructure
The provider follows the 6-file pattern:
Integration
src/index.ts(constants, schemas, provider classes)./hf-inferenceto package.json exports@huggingface/inferenceas optional peer dependencyUsage
Original prompt
This section details on the original issue you should resolve
<issue_title>Add HF and featherless inference</issue_title>
<issue_description>---
name: Add AI Providers
overview: Create two new AI providers (Hugging Face Inference API and Featherless.ai) following the established OpenAI provider pattern, each with constants, model schema, task implementations, provider class, worker, and barrel exports.
todos:
content: "Create the Hugging Face Inference provider (6 files: constants, model schema, job run fns, provider class, worker, index)"
status: pending
content: "Create the Featherless.ai provider (6 files: constants, model schema, job run fns, provider class, worker, index)"
status: pending
content: Update src/index.ts barrel exports and package.json (exports, dependencies, build scripts)
status: pending
isProject: false
Add Hugging Face Inference and Featherless.ai Providers
Both providers will follow the exact same architecture as the existing OpenAI provider in libs/packages/ai-provider/src/provider-openai/, with each consisting of 6 files organized into a directory with a
common/subdirectory.Architecture (per provider)
Each provider directory contains:
common/<PREFIX>_Constants.ts- Provider name constantcommon/<PREFIX>_ModelSchema.ts- Model config schema (provider discriminator, provider_config shape)common/<PREFIX>_JobRunFns.ts- Task run/stream functions + task registries<Name>Provider.ts- Provider class extendingAiProvider<Name>_Worker.ts- Worker registration functionindex.ts- Barrel exportsBoth providers support the same 4 task types as OpenAI:
TextGenerationTask,TextEmbeddingTask,TextRewriterTask,TextSummaryTask.Provider 1: Hugging Face Inference (
provider-hf-inference/)SDK:
@huggingface/inference(usesInferenceClient)HF_INFERENCE = "HF_INFERENCE"{ provider: "HF_INFERENCE", provider_config: { model_name, api_key?, provider? } }provideris an optional field to route to specific HF inference providers (e.g. "fal-ai", "fireworks-ai")import("@huggingface/inference")and call:client.chatCompletion(...)for text generation, rewriting, summarizationclient.featureExtraction(...)for embeddingsclient.chatCompletionStream(...)yieldingtext-deltaeventsKey file:
common/HFI_JobRunFns.ts-- pattern mirrors provider-openai/common/OpenAI_JobRunFns.ts but swaps the OpenAI SDK calls for HF Inference SDK calls.Provider 2: Featherless.ai (
provider-featherless/)SDK:
openai(Featherless is OpenAI-compatible, base URL:https://api.featherless.ai/v1)FEATHERLESS_AI = "FEATHERLESS_AI"{ provider: "FEATHERLESS_AI", provider_config: { model_name, api_key? } }FEATHERLESS_API_KEYenv var fallbackbaseURLtohttps://api.featherless.ai/v1organizationfield/v1/embeddings), soTextEmbeddingTaskwill be excludedKey file:
common/Featherless_JobRunFns.ts-- closely mirrors provider-openai/common/OpenAI_JobRunFns.ts with adjusted base URL and API key env var.Integration Changes
libs/packages/ai-provider/src/index.ts
Add 6 new export lines (constants, model schemas, provider classes) for both providers.
libs/packages/ai-provider/package.json
exportsentries:"./hf-inference"and"./featherless"@huggingface/inferencetopeerDependencies(optional),peerDependenciesMeta, anddevDependenciesopenaiis already a peer dependency (reused by Featherless)build-codeandwatch-codescripts to include the two new entry pointsFile Inventory (14 new files)
Hugging Face Inference (7 files):
src/provider-hf-inference/common/HFI_Constants.tssrc/provider-hf-inference/common/HFI_ModelSchema.tssrc/provider-hf-inference/common/HFI_JobRunFns.tssrc/provider-hf-inference/HfInferenceProvider.tssrc/provider-hf-inference/HFI_Worker.tssrc/provider-hf-inference/index.tsFeatherless.ai (7 files):
src/provider-featherless/common/Featherless_Constants.tssrc/provider-featherless/common/Featherless_ModelSchema.tssrc/provider-featherless/common/Featherless_JobRunFns.tssrc/provider-featherless/FeatherlessProvider.tssrc/provider-featherless/Featherless_Worker.ts✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.