--- 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 # X-API-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.™