File size: 2,798 Bytes
1b0bb55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4fd66b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1b0bb55
4fd66b3
 
 
1b0bb55
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
---

title: THOX ZeroGPU - Coder
emoji: πŸ’»
colorFrom: green
colorTo: gray
sdk: gradio
sdk_version: 5.49.1
python_version: "3.12"
app_file: app.py
pinned: false
short_description: Code generation and review on ZeroGPU
---


# THOX ZeroGPU - Coder

Serves **`thox-coder-7b`** behind an OpenAI-compatible endpoint on ZeroGPU, so that
Open WebUI can consume it as an ordinary "OpenAI API" connection.

| | |
|---|---|
| Base model | `Qwen/Qwen2.5-Coder-7B-Instruct` |
| LoRA adapter | `none (base weights)` |
| Served model name | `thox-coder-7b` |
| Hardware | ZeroGPU (`zero-a10g`), size `large` |



## Endpoints

- `GET  /v1/models` β€” model list
- `POST /v1/chat/completions` β€” chat completion, streaming and non-streaming
- `GET  /health` β€” liveness plus the resolved model identity
- `GET  /` β€” Gradio chat UI

## Connecting from Open WebUI

- **Base URL** β€” `https://tommytracx-thox-zero-coder.hf.space/v1`
- **API key** β€” the `THOX_API_KEY` value

## Authentication

`/v1/*` requires an API key, sent the way any OpenAI client already sends one:

```

Authorization: Bearer <key>          # X-API-Key: <key> also accepted

```

The key is the Space secret `THOX_API_KEY`. `/v1/models` is gated too β€” an open
`/v1/models` is how a bogus key gets mistaken for a working one. `GET /health` stays open
for liveness and reports `auth: required`. If the secret is unset the endpoint fails
**closed** (503), never open.

## OpenAI compatibility

Verified with the official `openai` Python SDK (see `conformance.py` in
`thox-zerogpu-spaces`), not by inspection:

| | |
|---|---|
| `client.models.list()` | βœ… |
| `client.chat.completions.create()` | βœ… `id` Β· `object` Β· `created` Β· `model` Β· `choices[].message` Β· `finish_reason` Β· `usage` |
| `stream=True` | βœ… `chat.completion.chunk` frames, `role` in the first delta, terminal `finish_reason`, `[DONE]` |
| multi-turn + `system` role | βœ… |
| `tools=[...]` function calling | βœ… OpenAI-shaped `tool_calls`, `finish_reason: tool_calls` |
| bad key | βœ… `401` β†’ `openai.AuthenticationError` |
| malformed body | βœ… `400 {"error": {...}}` β€” not FastAPI's `422 {"detail": [...]}` |
| out-of-range `max_tokens` / `temperature` / `top_p` | βœ… clamped, not rejected |

Sampling ceilings are enforced by clamping rather than Pydantic bounds, because
`Field(le=...)` makes FastAPI answer `422 {"detail": [...]}` while the OpenAI API answers
`400 {"error": {...}}` β€” and a client that reads `error.message` sees nothing at all.

## Source

Generated from the shared template in `thox-zerogpu-spaces`. `app.py` is byte-identical
across every THOX ZeroGPU model Space β€” only `thox_space_config.py` differs.

Your AI. Your Data. Your Rules.&trade;