File size: 1,230 Bytes
7037153
 
d7fd43f
 
 
7037153
d7fd43f
7037153
 
 
d7fd43f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
---
title: Bolt Hackathon Proxy
emoji: ⚡
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---

# Bolt Instruct V2 — Hackathon Proxy

A LiteLLM proxy that routes student requests to the Bolt Instruct V2 endpoint,
issues one API key per team, and logs every prompt→response pair for V3
training data.

## Required Space secrets

| secret | value |
|---|---|
| `HF_TOKEN` | a scoped token that can call the Bolt endpoint |
| `MASTER_KEY` | admin key for minting team keys, e.g. `sk-hack-master-...` |
| `DATABASE_URL` | managed Postgres URL (Supabase / Neon) — enables per-team keys |

## Durable traces

Add **persistent storage** to the Space so `/data/traces.jsonl` survives
restarts. Without it, traces are lost when the Space rebuilds.

## Mint a team key

```bash
curl https://<space-url>/key/generate \
  -H "Authorization: Bearer $MASTER_KEY" \
  -d '{"key_alias": "team-01", "max_budget": 20}'
```

## What students use

```python
from openai import OpenAI
client = OpenAI(base_url="https://<space-url>/v1", api_key="<team key>")
r = client.chat.completions.create(
    model="bolt-instruct-v2",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(r.choices[0].message.content)
```