Deployment strategies

v-keys make many rollout styles trivial. Pick one, or mix.

1) Signed-in only

Only authenticated users get a v-key. Anonymous visitors get none.

  • Klunq Widget shows read-only state with a callout: “Sign in to chat with the page agent.”
  • On sign-in, your backend uses the management key to call POST /key/generate with a user-specific key_alias and returns the sk-… to the widget (data-api-key).
  • Each user gets their own micro-budget, e.g. 2$/30d.

Best for: apps where anonymous AI would be abuse-prone.

2) Anonymous global pot

One shared key for unsigned visitors, capped tightly.

  • Create a single v-key with a deliberately low budget that resets daily:
curl -X POST "$PROXY_URL/key/generate" \
  -H "Authorization: Bearer $TEAM_MGMT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key_alias":"default","max_budget":1,"budget_duration":"1d","models":["gemma4"]}'
  • Bake its sk-… into the public <script data-api-key="sk-default…">. All anonymous traffic shares the 1$/day pot.
  • Signed-in users still get a personal key (strategy 1) — anonymous pot caps trial usage without a backend.

Best for: landing pages that want anonymous “try it” but bounded cost.

Anonymous keys are shared — one burst can exhaust the day. Keep the cap small and duration short (1d or even 1h). Monitor usage via the dashboard or /team/daily/activity.

3) Hybrid — default pot + per-user upgrades

Combine both:

  • Public default1$/day (global)
  • On sign-in → mint user-{id}5$/30d
  • Widget swaps data-api-key on auth state change.

Anonymous users see degraded/low-quota AI; signed-in users are unconstrained (within their larger cap). This nudges sign-ups.

4) Per-surface keys

Give each surface its own alias:

  • landing, docs, checkout, support
  • Or per-tenant: tenant-{id}

Spend per alias shows in the usage dashboard.

5) Other ideas

  • Ephemeral session keys (budget_duration:"1h"), deleted on tab close.
  • Rate-limited keys (rpm_limit, tpm_limit) for bots.

All strategies use the same embed — see Integration. Only data-api-key changes.

Choosing reset cadence

  • 30d — matches monthly billing, best for per-user pots
  • 1d — daily anonymous pot
  • 1h — demo rooms or per-session

Next: Integration · Managing keys

Help improve these docs

Found a gap? The widget is open source — open an issue or PR in the widget repo.