thox-zero-coder / README.md
tommytracx's picture
THOX ZeroGPU model Space
4fd66b3 verified
|
Raw History Blame Contribute Delete
2.8 kB
---
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;