| --- |
| title: Qwen3.5-0.8B Text API |
| emoji: 🔮 |
| colorFrom: blue |
| colorTo: purple |
| sdk: docker |
| app_port: 7860 |
| --- |
| |
| # Qwen3.5-0.8B Text API |
|
|
| Text inference service using [Qwen3.5-0.8B ONNX](https://huggingface.co/onnx-community/Qwen3.5-0.8B-ONNX). Non-streaming JSON responses. |
|
|
| ## Endpoints |
|
|
| ### `POST /prompt` |
| Text-only inference. Returns full response in one JSON body (no streaming). |
|
|
| **Body (JSON):** |
| - `prompt` (required) - Text prompt |
| - `max_tokens` (optional) - Max tokens to generate (default: 256) |
|
|
| **Response:** `{ "response": "..." }` |
|
|
| **Auth:** If `API_KEY` env var is set, send it via header `X-API-Key: <key>` or `Authorization: Bearer <key>`. If unset, no auth. |
|
|
| ### `GET /health` |
| Health check and model load status (no auth). |
|
|
| ## Usage |
|
|
| ```bash |
| # Without API key (when API_KEY is not set) |
| curl -X POST "http://localhost:7860/prompt" \ |
| -H "Content-Type: application/json" \ |
| -d '{"prompt": "What is 2+2?"}' |
| |
| # With API key |
| curl -X POST "http://localhost:7860/prompt" \ |
| -H "Content-Type: application/json" \ |
| -H "X-API-Key: your-secret-key" \ |
| -d '{"prompt": "What is 2+2?"}' |
| ``` |
|
|
| Set `API_KEY` in the environment to enable protection (e.g. `API_KEY=your-secret-key node server.js`). |
|
|