Files
descrybe/docs/V15_USAGE_BILLING.md
2026-10-16 00:34:06 +02:00

3.3 KiB

Descrybe v15 — usage and billing changes

Scope

  • Product Management no longer contains the independent JSON URL importer. Configure JSON URLs and mappings under Feeds.
  • /admin/analytics reads durable ai_usage_daily token totals, plus separately displays operational provider spend and credit use.
  • GET /api/admin/ai-costs/export?days=30&company_id=<uuid> downloads a provider operating-cost CSV in historical USD; it is not a customer invoice.
  • GET /api/admin/billing/invoices/export?company_id=<uuid> downloads genuine Stripe invoice references and values in their actual invoice currencies (minor units). Only recent invoices returned by Stripe are listed, up to 100.
  • GET /api/billing/usage/export?range=cycle downloads the signed-in company's usage CSV, not a tax invoice.
  • GET /api/billing/invoices returns genuine Stripe invoices to company owners. Manual invoices and plans without a Stripe customer have no documents here. Links to actual invoice/PDF are supplied by Stripe.
  • /admin/processing-costs GET and PUT support credit prices for a plan or individual company; precedence: company > plan > global. Migration 049 is required.
  • ai_model_prices includes published GPT-5.4 Mini, GPT-5 Mini, and GPT-6 Luna standard text token rates seeded only when missing. Migration 050 is required. Prices are in micro-USD; historical costs are never retroactively recalculated.

Money and usage accounting

Three values MUST NOT be added together as "total bill":

  1. AI provider cost: internal OpenAI/provider operating expense, recorded in USD at call time (input tokens, cached subset, output tokens, model-specific rate).
  2. Platform credits: in-product consumption units, not euros. Credit wallet is cumulative; the system does not yet retain a daily debit ledger, so 7-day credits are unavailable. Billing cycles separately record aggregate credits per cycle.
  3. Invoice amount: actual amount billed or due, available only from Stripe invoices or a separately issued manual invoice. An AI-cost estimate is not a charge to the customer.

To show EUR for an operational USD cost, an admin supplies a verified USD→EUR exchange rate in analytics. This is an estimate, not an invoice FX rate; per-day historical FX conversion is not implemented. The currency of a Stripe invoice is authoritative. Credit overrides do not edit Stripe subscription prices and only affect future debit amounts.

Rate configuration

Administrator opens /admin/analytics > Processing credit rules, selects scope (plan numeric ID or company UUID), feature, and credits. All overrides are ≥1 and ≤1,000,000. A1 company override can differ from the general plan defaults. This does not change the A1 contracted EUR subscription amount, which still needs to be set in Stripe/contract.

Deployment

Run migration 049/050 with your normal npm run migrate, then deploy API, worker and web. Do not install or invoke local Go commands from customer-facing documentation. Test real Stripe invoices with a non-mock customer account; do not treat mock portal data as a paid invoice.

Validation limits

Changes have been gofmt-checked. Full Go 1.25 build, Svelte production build, database-backed concurrency and Stripe integration tests are not available in this environment. Validate these before production deployment.