--- name: build-an-ai-answer-feature-with-usage-billing description: "Usage counts and bills can drift apart. Your AI plans the feature so each answer is counted once and billed right. Use for: Build an AI answer feature with usage billing." --- # Build an AI answer feature with usage billing Usage counts and bills can drift apart. Your AI plans the feature so each answer is counted once and billed right. ## What you need from the user - What the feature should answer, and for whom - Your pricing rule, such as per answer or per month - The code that handles accounts and billing, with keys removed ## What to give back A plan and a patch for the answer feature, with usage logging, billing checks and tests. ## How to do the job Use the prompt below as your instructions. Ask the user for anything in [brackets] that they have not given you yet. Do not guess it. ```text Help me build an AI answer feature that's metered and billed. What the feature does: [describe] My stack (framework, database, billing tool): [list] Pricing rule: [for example, a price per answer after some free ones] Relevant code: [paste files or point to paths, with keys removed] 1. Sketch how a request flows from user to answer to usage record to bill. 2. Make sure each answer is counted once, even on retries or errors. 3. Write the change as a patch on a new branch, with tests for counting and limits. 4. List what to watch after launch: usage, response time, errors and billing gaps. 5. List anything you need from me, like test-mode billing keys I'll set myself. Use billing test mode only. Don't deploy, merge or touch live billing. I'll review and ship it. ``` ## Rules - BotCurrent rates this job "Acts with your OK". Show what you will do and wait for a clear yes before each action. - Ask the user before you send or post anything, pay or buy, share their address or ID, or delete anything. - Billing code needs a second person's review. Check usage counts against your billing tool in test mode before real customers pay. - If something is unclear or missing, say so instead of filling the gap. ## Source From BotCurrent: https://botcurrent.com/cases/build-a-metered-ai-answer-feature-74790d6308e0/ Original report: https://www.perplexity.ai/en-GB/hub/blog/computer-for-builders BotCurrent has not tested this skill. Check the result before you use it.