daveadmin b21bfb2f1d Add NOK pricing catalog, credit ledger, success-based charging, and tier-gated model routing
- PricingCatalog.php: single source of truth for plans (free/plus/pro), top-ups,
  Stripe price env keys, tool costs (0–6 credits), STT variable billing, feature limits
- FreeTier.php: monthly-first credit deduction, ledger (user_tool_credit_ledger),
  STT reservation/settle/release, monthly reset, trial logic
- StripeClient.php: canonical SKUs (plus/pro/topup_100/300/1000), legacy aliases kept
- stripe-checkout.php: subscription vs payment mode, trial gating, catalog metadata
- stripe-webhook.php: idempotent via stripe_events, handles subscription lifecycle +
  invoice.paid renewal + one-time topup credit grants
- All API tools: success-based credit deduction (check before, charge after)
- transcribe.php: file-size heuristic reservation, settle from actual provider duration
- ask.php + LegalTools.php: ToolModels engine resolution — Pro gets gpt-4o
- KorrespondAgent.php + korrespond.php: tier-gated draft deployment —
  Free/Plus gets gpt-4o-mini, Pro gets gpt-4o
- pricing.php: NOK-only, plan cards, top-up packs, Organisation contact card,
  tool cost table, separate monthly/prepaid balance display
- 003_pricing_credit_catalog.sql: ledger and STT reservation tables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 13:42:27 +02:00
2026-05-08 17:12:38 +02:00

Do Better Norge Legal Tools Hub

MVP docroot for tools.dobetternorge.no.

Required environment

  • CaveauAI client access for DBN_CAVEAU_CLIENT_SLUG and DBN_CAVEAU_PACKAGE_SLUG
  • DBN_AZURE_OPENAI_ENDPOINT
  • DBN_AZURE_OPENAI_API_KEY
  • DBN_AZURE_OPENAI_API_VERSION
  • DBN_AZURE_OPENAI_CHAT_DEPLOYMENT
  • DBN_AZURE_OPENAI_EMBEDDING_DEPLOYMENT

Optional:

  • DBN_AI_PORTAL_ROOT (defaults to sibling ai-portal)
  • DBN_CAVEAU_CLIENT_SLUG (defaults to dobetter)
  • DBN_CAVEAU_PACKAGE_SLUG (defaults to family-legal)
  • DBN_TOOLS_SUPPORT_DIR
  • DBN_TOOLS_METADATA_LOG

Authentication

The login form authenticates against Caveau client_users for the configured client slug. The client must be active, the user must be active, and the client must have an active subscription to the configured corpus package.

Use scripts/setup-caveau-access.php for repeatable local/production setup of the Do Better Norge Caveau owner account, family-legal subscription, and white-label domain mappings. Pass the account password through DBN_SETUP_PASSWORD at runtime only; do not commit it.

The APIs process pasted text in memory and write only metadata such as tool name, latency, language, source count, chunk count, deployment, and anonymous session id.

S
Description
No description provided
Readme 33 MiB
Languages
PHP 77.3%
JavaScript 13.6%
CSS 9.1%