Files
descrybe/docs/V17_PLAN_CREDITS_LEGACY_API_CALLS.md
2026-10-16 00:55:28 +02:00

19 lines
2.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Descrybe v17 – plan credits, historical API results, AI call inspector
## Changes
- Admin → Billing → Create/Edit plan now contains plan-level credit rules for AI product processing, token increments, SEO meta, and campaigns. Blank = inherit global; company override takes precedence. Changes affect future debits only, not billed history.
- Product Management → Processed now includes old catalog records with actual generated title/description/SEO data even if their original status was `needs_review`. This does **not** approve these records: review workflow and persisted status are unchanged. Pre-v16 API jobs had no reliable origin identifier, so distinguishing historical API vs dashboard records cannot be done safely in SQL.
- Admin → AI Calls has a clearly labeled View action that opens a dialog instead of rendering details below the full table. The list and detail show input/output tokens and model-price-based calculated provider cost (USD) for new calls. Cached input tokens are also recorded. Historical cost/cached values remain NULL, rather than being assigned fake values.
- New migration `052_ai_call_details.sql` is required. Detailed prompts are retained for 7 days, separate from the durable, aggregate provider-usage billing ledger. AI call costs are not customer invoices or per-call credit deductions.
## Deploy
Use Git as the deployment source of truth. Push changes, run the normal `rb` script. It applies migration 052 before rebuilding the API and worker. Restart both. No backfill of historical per-call costs is attempted.
## Important verification
- On a test company, process a product by public API and check it appears under Processed with generated content.
- Check a previously generated Needs review product appears in both views, but its review status has **not** been changed.
- Create a test plan with product-processing cost = 3, reopen the dialog, and confirm the override persists; remove the override and confirm it inherits the global rate.
- Make a new provider call; Admin → AI Calls → View should show input, output, cached tokens and provider cost. Compare cumulative expense to the separate AI Cost report; do not use the debugging table for invoicing.
A full Go 1.25 + Svelte build and PostgreSQL integration run must be completed in deployment/staging: this environment cannot run those complete suites.