OpenAI starter module
Usage billing
Records token usage and sends billable totals to the Stripe pack without double counting.
- Files
- 3
- Lines
- 147
- Languages
- TypeScript
Included files
This page lists paths and purposes, not source contents.
FilePurposeLanguageLines
src/usage/billable-rollup.ts
Summarizes raw model usage into account totals that a billing layer can consume.
TypeScript
53 lines
src/usage/record-billable-usage.ts
Claims each OpenAI request once and records its token usage through the app adapter.
TypeScript
69 lines
src/usage/spending-cap.ts
Blocks an OpenAI request when the app account does not have enough allowance.
TypeScript
25 lines