Product Design & BuildingEngineering & Architecture

AI Billing & Operations Portal

Designing and building an AI usage and billing system, and establishing the foundation for a broader Operations Portal.

AI Billing Portal architecture concept. Customer VMs send AI inference requests through Azure API Management to AI providers and models: OpenAI, Anthropic and Google. A scheduled nightly import collects usage data through the Data Integration Layer, which normalizes and attributes it and applies effective-dated pricing, and delivers it to the AI Billing Portal.

The Challenge

As the company's agentic platform approached production, operational requirements were growing. Teams needed AI billing, customer health monitoring, and deployment tracking.

AI Billing was the most urgent requirement. The company needed to attribute AI consumption to customers, calculate costs across providers and models, and generate invoices. Gateway estimates could also differ from final provider charges, creating a need for reconciliation and pricing adjustments.

The AI Billing project established the architecture and interface foundation for the broader Operations Portal.

Interactive demo

A working prototype I built for this portfolio, using fictional customer and usage data with illustrative pricing. Try it here, or expand it for more room.

This demonstration is made for tablet and desktop screens. On a phone, use Expand to open it in the whole window.

AI Billing & Operations Portal

Explore customer billing, review an invoice, adjust pricing, and download a PDF. Switch to Usage Analytics to investigate the underlying requests.

AI Billing & Operations Portal
  1. Cobalt Ridge Insurance

Cobalt Ridge Insurance

Insurance · 3 applications

Markup
18%
Markup
18%

On provider cost · read-only

Platform fee
$400.00

Per month · illustrative

Last finalized invoice
$907.16

August 2026

November 2026 to date
$225.57

Estimated cost · through 15 Nov 2026

Invoices

Monthly, in USD · production usage only

PeriodInvoiceStatusEstimated costProvider costMarkupPlatform feeAmount billedActions
October 2026Not generatedReady to generate—————
September 2026INV-2026-0937Generated 2 Oct 2026Draft$439.75$444.58+$4.83$80.02$400.00$924.60
August 2026INV-2026-0841Finalized 9 Sep 2026Finalized$424.11$429.80+$5.69$77.36$400.00$907.16

Amounts are calculated from eligible production usage; development and test usage is excluded. Provider cost appears when a pricing adjustment has been saved. Pricing is illustrative.

Pricing Adjustment History

InvoiceSavedEstimated costProvider costCost differenceSupporting reference
INV-2026-0937CurrentSeptember 202614 Oct 2026$439.75$444.58+$4.83Corrected provider statement, September 2026 (ref. PS-26-09-1187-R1)
INV-2026-0937September 20266 Oct 2026$439.75$447.12+$7.37Provider statements, September 2026 (ref. PS-26-09-1187)
INV-2026-0841August 20268 Sep 2026$424.11$429.80+$5.69Provider statements, August 2026 (ref. PS-26-08-4471)

Product Design & Architecture

The decisions that shaped the portal: who a customer is, where usage comes from, how it's priced, and how an invoice is reconciled.

Financial Workflow

Gateway estimates can differ from final provider charges. I designed reconciliation and pricing adjustments to account for those differences. The financial approval process still required CFO validation.

Pricing Architecture

I implemented an effective-dated pricing model that calculates costs using the rates applicable when each AI request occurred. Automated rate updates were planned, with manual maintenance as a fallback.

AI Gateway

The initial Cloudflare approach proved impractical for the required customer data isolation. Working with DevOps, we switched to Azure API Management and adapted the integration design.

Customer Identity

I chose Salesforce Account ID as the customer identifier. It was already available during customer setup and could be included in API calls, eliminating the need to maintain separate customer mappings whenever Azure tokens changed.

Planned data flow

Planned architecture

Salesforce Account ID is included in every API call, attributing each request to its customer at every stage, through to the invoice.

  1. Azure API ManagementThe AI gateway every model request passes through
  2. Nightly Usage ImportUsage collected from the gateway in a daily batchNightly
  3. Normalized Usage RecordsOne record format across providers and models
  4. Effective-Dated PricingThe rates in force when each request ran
  5. Monthly Invoice CalculationA draft invoice per customer, ready for review
Nightly processing was sufficient for billing. Real-time usage data was not a V1 requirement.

From Usage to Invoice

The billing workflow brings together AI usage, provider costs, pricing adjustments, and platform fees to produce customer invoices. This sample shows the resulting invoice, including its pricing adjustment history.

View Sample Invoice(PDF, opens in a new tab)
Draft invoice INV-2026-0937 for Cobalt Ridge Insurance, September 2026: estimated inference cost $439.75, provider cost $444.58, markup $80.02 and a $400.00 platform fee, for an amount billed of $924.60, followed by the pricing adjustment history.
Sample invoice generated by the AI Billing Portal using fictional customer and usage data.

My Contribution

I led requirements gathering, product definition, interaction design, and architectural decisions.

Working with AI coding assistants, I developed the data model, API specifications, frontend and backend implementation, database conversion scripts, and tests.

DevOps was responsible for production PostgreSQL setup and external API access. Engineering would complete the live API integration.

The interactive demonstration on this page is my own reconstruction for this portfolio, with fictional data and illustrative pricing. It doesn't use the original product's code or reproduce its design.

Project Status

Functional V1 Application

The result was a functional V1 application, with approximately 80% of development completed. Customer billing, usage analytics, and financial workflows were implemented. The primary remaining work was the Data Integration Layer, which depended on input from DevOps.

Outstanding work:

  • Live data integration
  • Production database deployment
  • Automated pricing synchronization
  • Final validation of the financial approval process