Spaces:
Running
Running
Deploy FreeLLMAPI cloud proxy (prebuilt ghcr image, port 7860, /data db)
Browse files- Dockerfile +24 -0
- README.md +38 -5
Dockerfile
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ghcr.io/tashfeenahmed/freellmapi:latest
|
| 2 |
+
|
| 3 |
+
# HF Spaces runs containers as UID 1000 and expects the app on port 7860.
|
| 4 |
+
# The base image already runs as `node` (uid 1000) via its entrypoint,
|
| 5 |
+
# so this stays compatible. We only remap port + DB path and fix perms.
|
| 6 |
+
USER root
|
| 7 |
+
RUN mkdir -p /data && chmod 777 /data \
|
| 8 |
+
&& mkdir -p /app/server/data && chown -R node:node /app/server/data || true
|
| 9 |
+
|
| 10 |
+
ENV NODE_ENV=production \
|
| 11 |
+
PORT=7860 \
|
| 12 |
+
HOST=:: \
|
| 13 |
+
FREELLMAPI_INSTALL_METHOD=docker \
|
| 14 |
+
FREEAPI_DB_PATH=/data/freellmapi.db
|
| 15 |
+
|
| 16 |
+
EXPOSE 7860
|
| 17 |
+
|
| 18 |
+
# Keep upstream entrypoint (fixes perms, then drops to `node`).
|
| 19 |
+
# Runs as root when possible so the entrypoint can chown /data;
|
| 20 |
+
# HF Spaces executes containers as UID 1000 β the entrypoint detects
|
| 21 |
+
# non-root and just execs the server directly (works since /data is 777).
|
| 22 |
+
USER root
|
| 23 |
+
|
| 24 |
+
CMD ["node", "server/dist/index.js"]
|
README.md
CHANGED
|
@@ -1,10 +1,43 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: FreeLLMAPI Cloud Proxy
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
+
short_description: FreeLLMAPI β one OpenAI-compatible endpoint
|
| 10 |
+
tags:
|
| 11 |
+
- llm
|
| 12 |
+
- openai-compatible
|
| 13 |
+
- proxy
|
| 14 |
+
- freellmapi
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# FreeLLMAPI β Cloud Proxy on Hugging Face Spaces
|
| 18 |
+
|
| 19 |
+
This Space runs [tashfeenahmed/freellmapi](https://github.com/tashfeenahmed/freellmapi) from the prebuilt image
|
| 20 |
+
`ghcr.io/tashfeenahmed/freellmapi:latest` β **no local clone, no local disk used**.
|
| 21 |
+
|
| 22 |
+
- Dashboard + API on port `7860` (HF requirement)
|
| 23 |
+
- SQLite DB at `/data/freellmapi.db` (ephemeral β see persistence note)
|
| 24 |
+
- Secrets (`ENCRYPTION_KEY`, admin config) are set in **Space β Settings β Variables and secrets**, never committed here.
|
| 25 |
+
|
| 26 |
+
## Endpoints
|
| 27 |
+
|
| 28 |
+
- Dashboard: `https://<your-space>.hf.space/`
|
| 29 |
+
- Health: `https://<your-space>.hf.space/api/ping`
|
| 30 |
+
- OpenAI-compatible: `https://<your-space>.hf.space/v1/chat/completions`
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
curl https://<your-space>.hf.space/v1/chat/completions \
|
| 34 |
+
-H "Authorization: Bearer freellmapi-YOUR-UNIFIED-KEY" \
|
| 35 |
+
-H "Content-Type: application/json" \
|
| 36 |
+
-d '{"model":"auto","messages":[{"role":"user","content":"Say hello from FreeLLMAPI."}]}'
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## First-run setup
|
| 40 |
+
|
| 41 |
+
1. Open the Space URL, create the first dashboard account (or pre-create via `FREEAPI_CONFIG_JSON`, see below).
|
| 42 |
+
2. Go to **Keys** page β add provider keys β reorder **Fallback Chain**.
|
| 43 |
+
3. Copy your unified `freellmapi-...` key from the Keys page header β point any OpenAI SDK at the Space URL.
|