mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-07-10 00:14:16 +00:00
## Problem
FCC did not expose Hugging Face Inference Providers as a selectable
backend. Voice transcription also used the legacy `HF_TOKEN` setting
instead of the canonical Hugging Face API key.
## Changes
| Before | After |
| --- | --- |
| Hugging Face models could not be selected through provider-prefixed
routing. | Hugging Face routes through a thin OpenAI-chat provider using
`huggingface/<model>`. |
| Provider credentials did not include `HUGGINGFACE_API_KEY`. | Admin
config, settings, smoke config, and docs use `HUGGINGFACE_API_KEY`. |
| `HF_TOKEN` remained a voice-only config key. | Owned dotenv files
migrate `HF_TOKEN` to `HUGGINGFACE_API_KEY`, while explicit
`FCC_ENV_FILE` users get a warning. |
| Version metadata stayed on `2.6.0`. | Version metadata moves to
`3.0.0` with a refreshed lockfile. |
<!-- greptile_comment -->
<details open><summary><h3>Greptile Summary</h3></summary>
This PR adds Hugging Face Inference Providers as a selectable backend.
The main changes are:
- Adds a `huggingface` provider using the shared OpenAI-compatible chat
transport.
- Wires `HUGGINGFACE_API_KEY` and `HUGGINGFACE_PROXY` through settings,
Admin UI, provider catalog, runtime factory, and smoke config.
- Migrates owned dotenv files from `HF_TOKEN` to `HUGGINGFACE_API_KEY`
and warns for explicit `FCC_ENV_FILE` users.
- Updates voice transcription plumbing to use the canonical Hugging Face
key.
- Updates docs, examples, version metadata, lockfile, and related tests.
</details>
<h3>Confidence Score: 5/5</h3>
Safe to merge with minimal risk.
No blocking correctness or security issues were identified. The new
provider reuses the existing OpenAI-chat transport pattern. Provider
wiring, env migration, Admin UI, smoke config, voice plumbing, and tests
are consistent.
No files require special attention.
<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>
**What T-Rex did**
- The Pytest suite for providers, runtime, env migrations, config, and
contract tests ran and completed with exit code 0 and 198 tests passed.
- The HuggingFace runtime validator script ran and completed
successfully, printing provider\_class=HuggingFaceProvider,
default\_base\_url=https://router.huggingface.co/v1,
credential\_env=HUGGINGFACE\_API\_KEY, and
admin\_field=HUGGINGFACE\_API\_KEY:\[REDACTED\].
- Logs from both runs were captured as artifacts to aid review.
<a
href="https://app.greptile.com/trex/runs/13308618/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>
<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>
<details open><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| providers/huggingface/client.py | Implements Hugging Face via the
shared OpenAI-chat transport with `extra_body` passthrough. |
| config/provider_catalog.py | Registers Hugging Face metadata, default
router URL, credential, proxy, and capabilities. |
| providers/runtime/factory.py | Wires Hugging Face into runtime
provider construction. |
| config/env_migrations.py | Adds safe `HF_TOKEN` to
`HUGGINGFACE_API_KEY` dotenv migration helpers for owned env files. |
| config/settings.py | Adds Hugging Face API key/proxy settings and
removes the legacy `hf_token` setting. |
| api/admin_config/manifest.py | Removes the voice-only `HF_TOKEN` field
and adds Hugging Face smoke model configuration. |
| api/admin_config/provider_manifest.py | Adds Admin UI labeling and
description for `HUGGINGFACE_API_KEY`. |
| messaging/transcription.py | Renames local Whisper token handling to
use the canonical Hugging Face API key. |
| smoke/lib/config.py | Adds Hugging Face smoke-test default model and
credential detection. |
| tests/providers/test_huggingface.py | Adds provider tests for Hugging
Face base URL, request body policy, streaming, and cleanup. |
</details>
<details open><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User as Admin/User
participant Settings as Settings + dotenv migration
participant Catalog as Provider Catalog
participant Runtime as Provider Runtime Factory
participant HF as HuggingFaceProvider
participant Router as router.huggingface.co/v1
User->>Settings: "Configure MODEL=huggingface/<model> and HUGGINGFACE_API_KEY"
Settings->>Settings: Rename owned HF_TOKEN to HUGGINGFACE_API_KEY when present
Settings->>Catalog: Resolve huggingface descriptor and credential/proxy attrs
Catalog->>Runtime: Build ProviderConfig for huggingface
Runtime->>HF: Create HuggingFaceProvider
HF->>Router: Stream OpenAI-compatible chat completion
Router-->>HF: Streaming chunks
HF-->>User: Anthropic SSE response
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User as Admin/User
participant Settings as Settings + dotenv migration
participant Catalog as Provider Catalog
participant Runtime as Provider Runtime Factory
participant HF as HuggingFaceProvider
participant Router as router.huggingface.co/v1
User->>Settings: "Configure MODEL=huggingface/<model> and HUGGINGFACE_API_KEY"
Settings->>Settings: Rename owned HF_TOKEN to HUGGINGFACE_API_KEY when present
Settings->>Catalog: Resolve huggingface descriptor and credential/proxy attrs
Catalog->>Runtime: Build ProviderConfig for huggingface
Runtime->>HF: Create HuggingFaceProvider
HF->>Router: Stream OpenAI-compatible chat completion
Router-->>HF: Streaming chunks
HF-->>User: Anthropic SSE response
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["Add Hugging Face inference
provider"](
|
||
|---|---|---|
| .. | ||
| test_cli.py | ||
| test_cli_manager_edge_cases.py | ||
| test_cli_ownership.py | ||
| test_codex_model_catalog.py | ||
| test_entrypoints.py | ||
| test_managed_claude.py | ||
| test_process_registry.py | ||