Spaces:
Running
Running
File size: 1,538 Bytes
40416c1 ea89131 40416c1 ea89131 40416c1 ea89131 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ---
title: Llm Proxy
emoji: "🤗"
colorFrom: red
colorTo: indigo
sdk: docker
pinned: false
license: mit
short_description: OpenAI-compatible proxy for Hugging Face Inference Providers
---
# LLM proxy
The service exposes an OpenAI-like `/v1/chat/completions` endpoint and routes calls through Hugging Face Inference Providers.
## Configuration
- `HF_TOKEN`: Hugging Face user token with the **Inference Providers** permission. `HF_API_KEY` remains supported for compatibility.
- `API_KEYS`: comma-separated bearer tokens accepted by this proxy.
- `HF_MODELS`: optional comma-separated `alias=model-id` mappings. Default: `gpt-oss=openai/gpt-oss-120b:cerebras`.
- `HF_TIMEOUT_SECONDS`: optional provider timeout, default `60`.
Do not append a provider suffix unless you intentionally want to pin one. With a plain model ID, the Hugging Face router can select an available provider.
Example `.env`:
```dotenv
HF_TOKEN=hf_your_token
API_KEYS=local-secret
HF_MODELS=gpt-oss=openai/gpt-oss-120b:cerebras
```
Run locally with `start.bat`, then call:
```powershell
$headers = @{ Authorization = "Bearer local-secret" }
$body = @{ model = "gpt-oss"; messages = @(@{ role = "user"; content = "Привет!" }) } | ConvertTo-Json -Depth 4
Invoke-RestMethod http://127.0.0.1:8000/v1/chat/completions -Method Post -Headers $headers -ContentType "application/json" -Body $body
```
Free Hugging Face accounts receive only a small monthly inference credit. Requests stop after the credit is exhausted unless additional credits are purchased.
|