Skip to content
All articles
Articles

Programmatic Access to AI Costs: A FinOps Practitioner's Billing API Guide

A practical reference for FinOps and platform teams on how to access AI cost data programmatically across the major model providers, hyperscalers, and coding tools — including what is available, what is not, and how to build a minimal cost aggregation pipeline.

11 min read
FinOpsbilling APIsAI cost managementengineering

Key takeaways


Why programmatic billing access matters

Automation and reporting cadence.

Anomaly detection.

Business context mapping.

Portfolio-level reporting.


Model providers

OpenAI

What is available:

Implementation example: A typical daily cost pull from OpenAI's Costs API:

curl https://api.openai.com/v1/organization/costs \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -d "start_date=2026-06-01" \
  -d "end_date=2026-06-10"

Returns JSON with cost breakdowns by project, model, and date. Parse and load into your data warehouse for aggregation with other AI costs.

Allocation support:

Practical note:

Gap:


Anthropic

What is available:

Allocation support:

Practical note:


Google (Vertex AI and Gemini API)

Vertex AI (enterprise path):

Implementation example: Query Vertex AI costs from BigQuery billing export:

SELECT
  DATE(usage_start_time) as date,
  service.description as service,
  sku.description as sku,
  SUM(cost) as total_cost
FROM `project.dataset.gcp_billing_export_v1_XXXXXX`
WHERE service.description = 'Vertex AI'
  AND DATE(usage_start_time) >= '2026-06-01'
GROUP BY date, service, sku
ORDER BY date DESC;

This pattern works for any GCP AI service and integrates with existing cloud FinOps workflows.

Gemini Developer API (consumer/developer path):

Allocation support:


AWS Bedrock

What is available:

Allocation support:

Practical note:


Azure OpenAI

What is available:

Allocation support:

Copilot-specific note:


AI coding tools

GitHub Copilot

What is available:

Allocation support:

Gap:


Amazon Q Developer

What is available:


Cursor, Windsurf, JetBrains AI Assistant

Cursor:

Windsurf (Codeium):

JetBrains AI Assistant:


Building a minimal AI cost aggregation pipeline

Step 1: Enumerate all AI cost sources.

Step 2: Implement scheduled pulls from billing APIs.

Step 3: Normalise to a common schema.

Step 4: Enrich with business context.

Step 5: Build reporting and alerting.

Step 6: Close the gaps.


What this enables


References and further reading

Related reading