File size: 1,199 Bytes
fa2b547
34e1647
78cfb21
 
 
fa2b547
78cfb21
fa2b547
 
34e1647
78cfb21
34e1647
78cfb21
 
 
34e1647
 
78cfb21
34e1647
 
 
78cfb21
34e1647
78cfb21
0e79077
 
78cfb21
0e79077
78cfb21
 
 
 
0e79077
 
 
 
 
 
34e1647
 
0e79077
34e1647
78cfb21
0e79077
 
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
---
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`).