Files
tenant-registry/internal/server
Sharang ParnerkarandClaude Opus 5 972cae6195
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 22m6s
ci / image (pull_request) Skipped
feat(licences): per-tenant LiteLLM key with a Werkpilot grant
A Werkpilot trial needed a hand-made LiteLLM key before the CLI could talk
to a model. The registry now provisions one when it issues the licence:

- POST /v1/licences for product=werkpilot calls LiteLLM /key/generate with
  the tenant in the alias and metadata, the plan's monthly budget and the
  configured model list, stores LiteLLM's token id on the licence row
  (migration 0007) and returns llm_api_key + llm_base_url in the grant.
  The secret is returned exactly once and never persisted.
- A heartbeat renewal moves the key to the new licence row instead of
  generating a second one, because the secret cannot be re-read and the
  CLI still holds it.
- Revoking a licence deletes the key; a 404 from LiteLLM is fine.
- LiteLLM being off, unreachable or refusing never fails the licence: the
  grant comes back without the LLM fields and with
  warnings: ["llm_key_unavailable"].

Configured with LITELLM_BASE_URL, LITELLM_MASTER_KEY (empty = feature off),
LITELLM_MODELS, LITELLM_BUDGET_TRIAL and LITELLM_BUDGET_DEFAULT.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-12 21:43:33 +02:00
..