PRAHARI

PRAHARI backend — Claude proxy (Cloudflare Worker)

A tiny serverless proxy so the app can use real Claude AI evaluation without shipping the Anthropic API key in the client. The app works fully offline with its built-in engine; this backend is optional and upgrades SSB scoring to a live LLM.

Deploy (free tier)

npm i -g wrangler
cd backend
wrangler login
wrangler secret put ANTHROPIC_API_KEY      # paste your Anthropic key when prompted
wrangler deploy

You’ll get a URL like https://prahari-proxy.<you>.workers.dev.

Use it

POST /eval

{ "answers": ["Discipline makes a soldier reliable.", "I overcome fear by preparing."], "label": "WAT set" }

returns

{ "olq": { "Reasoning": 78, "Initiative": 66, "...": 0 }, "index": 72, "title": "Good potential.", "tag": "Near recommend-line", "good": ["..."], "bad": ["..."] }

Wiring the app to it

In app/index.html the client currently calls Anthropic directly when you paste a key in Settings. For production, point it at this proxy instead (swap the fetch(...api.anthropic.com...) in claudeEval() for fetch('<your-worker-url>/eval', { method:'POST', body: JSON.stringify({answers,label}) })) so no key lives in the client.