For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DashboardSign Up
  • Getting Started
    • Welcome
    • Quick Start
    • Authentication
  • Native Mode
    • Overview
    • OpenAI
    • Anthropic
    • Gemini
  • Unified Mode
    • Overview
    • Python
    • TypeScript
    • cURL
  • Platform
    • Key Management
    • Rate Limits & Budgets
    • Usage & Billing
    • Error Reference
  • API Reference
DashboardSign Up
On this page
  • Credit-based billing
  • How costs are calculated
  • Viewing your savings
  • Purchasing credits
  • Usage tracking
  • Per-key usage
  • Transaction history
  • Audit trail
Platform

Usage & Billing

Credits, cost tracking, and savings
Was this page helpful?
Edit this page
Previous

Error Reference

Error codes and what they mean
Next
Built with

Credit-based billing

Gateway AI uses a prepaid credit model. You purchase credits, and each API request deducts from your balance based on token usage and model pricing.

How costs are calculated

For each request, the gateway tracks:

  • Prompt tokens — tokens in your input/messages
  • Completion tokens — tokens in the model’s response
  • Cached tokens — tokens served from provider cache (reduced cost)

The cost is calculated using the model’s per-token pricing, which has two components:

  • Your cost — the discounted rate you pay through Gateway AI
  • Market rate — what you would pay going directly to the provider

The difference is your savings.

Viewing your savings

Your dashboard overview shows:

  • Total Spend — what you actually paid
  • Market Rate — what you would have paid at standard provider rates
  • You Saved — the dollar amount and percentage below market rate

These metrics are available for any time period and can be broken down by key, provider, model, or date.

Purchasing credits

Go to Settings > Billing in your dashboard.

Available credit packages are displayed with their price and credit amount. Click a package to purchase:

  • Production mode — redirects to Stripe checkout for secure payment
  • Development mode — credits are granted instantly (no payment required)

Usage tracking

The Usage page in your dashboard provides:

  • Summary metrics — total requests, tokens, cost, and savings
  • Breakdown — group by date, key, provider, or model
  • Charts — spend over time, cost by model, cost by provider

Per-key usage

Each key tracks its own spend. View per-key usage in the keys table or via the management API at GET /v1/keys/{id}/usage.

Transaction history

Every credit change is recorded in an append-only ledger:

TypeDescription
purchaseCredits added via payment
usage_debitCredits deducted for API usage
adjustmentManual credit adjustment by admin

View your transaction history in Settings > Billing.

Audit trail

Every API request is logged with:

  • Timestamp, provider, model
  • Token counts (prompt, completion, cached)
  • Cost (your rate and provider rate)
  • Latency, HTTP status
  • Key name, client IP
  • Streaming flag, user agent

View the full audit trail in the Audit page. Export as CSV or JSON for compliance reporting.

No prompt or completion content is stored — only metadata.