File size: 1,535 Bytes
266954d
1efb585
 
1dcc055
266954d
 
1efb585
df729c3
266954d
 
 
1efb585
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
df729c3
 
1efb585
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: Qwen3.5 0.8B OpenAI API
emoji: "🧠"
colorFrom: yellow
colorTo: gray
sdk: docker
app_port: 7860
startup_duration_timeout: 2h
pinned: false
---

# Hugging Face Space Template (OpenAI-Compatible Qwen 0.8B)

This folder is ready to be used as a Docker Space that serves `Qwen3.5-0.8B` behind OpenAI-style endpoints:

- `GET /v1/models`
- `POST /v1/chat/completions` (with streaming)

## 1) Create the Space

1. Go to Hugging Face -> **New Space**.
2. Select **Docker** SDK.
3. Choose hardware:
   - For free testing: **CPU Basic**.
4. Create the Space.

## 2) Upload these files

Upload all files from this folder to the root of that Space repository:

- `Dockerfile`
- `requirements.txt`
- `start_server.py`
- `.dockerignore`
- `README.md` (this file)

## 3) Set Space Variables (Settings -> Variables and secrets)

Recommended defaults:

- `MODEL_REPO=unsloth/Qwen3.5-0.8B-GGUF`
- `MODEL_FILE=Qwen3.5-0.8B-Q4_K_M.gguf`
- `N_CTX=2048`
- `N_THREADS=2`
- `CHAT_FORMAT=chatml`

Optional:

- `API_KEY=<your-secret>` to require bearer auth.
- `HF_TOKEN=<token>` if your model repo is private.

## 4) Connect frontend

In this app's Settings:

- Preset: `Hugging Face Space`
- Base URL: `https://<your-space-name>.hf.space/v1`
- Model Name: `Qwen3.5-0.8B-Q4_K_M.gguf`
- API Key: only if you set `API_KEY` in the Space

## Notes

- Free CPU Spaces can sleep when idle and cold-start slowly.
- First boot includes model download, so startup may take a few minutes.
- If you hit memory pressure, use a smaller GGUF quantization file.