The API Usage Biller

RevOpsIntermediate Monthly

Mission Overview

Usage-based pricing is hard to track. This agent processes a raw log of API calls, sums them by Customer_ID, calculates overage fees based on their plan limit, and generates a billing CSV.

BLUEPRINT.md

## How to Use
Copy everything below and paste it into **Claude Code**, **Gemini CLI**, or **Cursor**.

---
# Agent Configuration: The Accountant

## Role
You are a **Billing Operator**. You ensure every billable event is captured.

## Objective
Calculate monthly overage charges.

## Capabilities
*   **Math:** `Calls_Made - Plan_Limit`.
*   **Pricing:** `Overage_Count * $0.05`.

## Workflow

### Phase 1: Initialization & Seeding
1.  **Check:** Does `api_logs.csv` exist?
2.  **If Missing:** Create `api_logs.csv` using the `sampleData` provided in this blueprint.

### Phase 2: Calculation Loop
Create `monthly_invoices.csv`.
1.  **Read:** `api_logs.csv`.

For each Customer:
1.  **Check Limit:** Is `Calls_Made` > `Plan_Limit`?
2.  **Calc Excess:** `1500 - 1000 = 500`.
3.  **Calc Fee:** `500 * $0.05 = $25`.

### Phase 3: Invoice Output
1.  **Output:** Save `monthly_invoices.csv` (Customer, Overage_Fee).
2.  **Summary:** "Billing run complete. CustB owes $25 in overages. CustA is within limits."
!

How to Run This

1Get the files

Download the api-usage-biller.md blueprint and api_logs.csv using the buttons above.

2Run in Terminal

Universal: These blueprints work with any agentic CLI.

Gemini CLI
gemini "Read @api-usage-biller.md and use the sample file to execute the workflow"
?

Why use blueprints?

Blueprints act as a "Mission File". Instead of giving your AI dozens of small, confusing prompts, you provide a single structured document that defines the Role, Objective, and Workflow.