File size: 1,526 Bytes
fe7add9
46258b3
 
fe7add9
46258b3
fe7add9
46258b3
fe7add9
 
 
46258b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: OpenHands Simplified Backend
emoji: πŸ€–
colorFrom: indigo
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
---

# OpenHands Simplified Backend (Phase 1)

FastAPI service that exposes:

- `GET /health` β€” liveness + provider/key status
- `POST /api/chat` β€” non-streaming chat
- `POST /api/chat/stream` β€” SSE; auto-routes chat vs E2B execution
- `POST /api/execute` β€” SSE; always runs in E2B sandbox
- `POST /api/intent` β€” intent classifier only

## Environment variables (set in HF Space β†’ Settings β†’ Secrets)

| Name              | Required | Notes                                  |
|-------------------|----------|----------------------------------------|
| `GEMINI_KEY`      | optional | comma-separated Gemini API keys        |
| `SAMBANOVA_KEY`   | optional | comma-separated SambaNova API keys     |
| `GITHUB_KEY`      | optional | comma-separated GitHub Models tokens   |
| `E2B_API_KEY`     | **yes**  | required for execution endpoints       |
| `E2B_TEMPLATE`    | optional | custom sandbox template id             |
| `ALLOWED_ORIGINS` | optional | CSV; defaults to `*`                   |
| `LOG_LEVEL`       | optional | default `INFO`                         |

At least ONE LLM provider key must be set.

## Test (after deploy)

```bash
curl https://<your-space>.hf.space/health
curl -N -X POST https://<your-space>.hf.space/api/execute \
  -H 'Content-Type: application/json' \
  -d '{"message":"Create proof.txt with the current UNIX timestamp and print its contents."}'
```