PrajwalN-AIS's picture
Upload folder using huggingface_hub
d7fd43f verified
|
Raw History Blame Contribute Delete
1.23 kB
---
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)
```