File size: 1,641 Bytes
83ec29a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Ornith 1.0 9B API
emoji: 🦅
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: mit
---

# Ornith-1.0-9B — OpenAI-compatible API (llama.cpp)

Serves `deepreinforce-ai/Ornith-1.0-9B` (Q4_K_M GGUF) as an **OpenAI-compatible
REST API** via llama.cpp's built-in server.

> **Note:** This is the CPU build for the free tier (2 vCPU, no GPU). A 9B model
> on CPU is usable but slow (~5-10 tok/s). See the Dockerfile footer for the GPU
> variant if you need real speed.

## Endpoints

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

Base URL: `https://<your-username>-<space-name>.hf.space/v1`

## Use it

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://<your-username>-<space-name>.hf.space/v1",
    api_key="not-needed",           # llama.cpp server ignores it by default
)

resp = client.chat.completions.create(
    model="ornith",
    messages=[{"role": "user", "content": "Write a Python LRU cache with a docstring."}],
    temperature=0.6, top_p=0.95,
    stream=True,
)
for chunk in resp:
    print(chunk.choices[0].delta.content or "", end="")
```

Or with curl:

```bash
curl https://<your-username>-<space-name>.hf.space/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"ornith","messages":[{"role":"user","content":"hello"}],"temperature":0.6}'
```

## Deploy

1. Create a new Space → **Docker** (blank template).
2. Add this `Dockerfile` and rename this file to `README.md` in the Space repo.
3. Push. First build takes a few minutes (it bakes the ~5.5 GB model into the image).