Vercel AI Gateway Integration

Track aggregate AI credit usage from Vercel's AI Gateway.

Overview

Grafient tracks your Vercel AI Gateway spending by reading your credit balance from the Vercel API. This gives you a single view of your AI Gateway costs alongside your other AI providers.

Vercel's AI Gateway API currently provides aggregate credit usage only - it does not break down costs by individual model or request. Your dashboard will show total daily spend as a single "Vercel AI Gateway" line item.

Prerequisites

  • A Vercel account with AI Gateway enabled and credit usage.
  • A Grafient account on the Free, Pro, or Ultimate plan.

Step 1: Generate an AI Gateway API Key

You need an AI Gateway API key (not a regular Vercel account token).

  1. Go to your team's AI Gateway settings in the Vercel dashboard.
  2. Navigate to Settings or API Keys.
  3. Create a new API key.
  4. Copy the key — it is only shown once.

A regular Vercel API token from /account/tokens will not work. You must use an AI Gateway-specific API key.

Step 2: Add the Integration in Grafient

  1. In Grafient, navigate to Integrations in the sidebar.
  2. Click Add Integration.
  3. Select Vercel AI Gateway as the provider.
  4. Paste the API token from Step 1 into the API Key field.
  5. Optionally add a label (e.g. Production - Vercel AI).
  6. Click Add Integration to save.

What Happens Next

Once connected, Grafient will:

  1. Validate your token by querying the credits endpoint.
  2. Start tracking daily spend - each sync captures the current credit balance and computes the daily delta from the previous sync.
  3. Sync daily - an automated sync runs each day to capture the latest usage.

Costs appear on the Dashboard as a single "Vercel AI Gateway" line item.

How Delta Tracking Works

Vercel's API returns a running total of credits used, not daily costs. Grafient computes your daily spend by comparing the current total with the previous sync's total:

Daily cost = Current total_used − Previous total_used

This means the first sync establishes a baseline, and subsequent syncs calculate the difference. If you add credits to your balance, it does not affect the cost calculation.

Data Collected

Data PointDescription
Daily cost (USD)Total AI Gateway spend per day (aggregate)
Credit balanceRemaining credit balance at time of sync
Total credits usedCumulative credits consumed

Limitations

  • No model breakdown: Vercel's API does not provide per-model cost data. All usage appears as "Vercel AI Gateway".
  • No token counts: Individual token usage (input/output) is not available through this API.
  • Delta-based tracking: The first sync establishes a baseline. Daily costs are calculated as the difference from the previous sync.

Troubleshooting

No cost data after sync

  • Verify AI Gateway usage: If there has been no AI Gateway usage, the credit total may be zero.
  • Wait for second sync: The first sync establishes a baseline. Daily costs appear starting from the second sync.
  • Try Force Sync: Click the refresh icon on your integration card to trigger a manual sync.