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 a Vercel API Token
- Go to Vercel Account Settings.
- Click Create Token.
- Enter a name (e.g.
grafient-reader). - Set the scope to Full Account (required to access AI Gateway data).
- Set an expiration (or choose "No Expiration" for uninterrupted syncs).
- Click Create Token.
- Copy the token — it is only shown once.
Store this token securely. It is only displayed once during creation. If you lose it, you'll need to create a new one.
Step 2: Add the Integration in Grafient
- In Grafient, navigate to Integrations in the sidebar.
- Click Add Integration.
- Select Vercel AI Gateway as the provider.
- Paste the API token from Step 1 into the API Key field.
- Optionally add a label (e.g.
Production — Vercel AI). - Click Test Connection — a green checkmark confirms the token works.
- Click Add Integration to save.
What Happens Next
Once connected, Grafient will:
- Validate your token by querying the credits endpoint.
- Start tracking daily spend — each sync captures the current credit balance and computes the daily delta from the previous sync.
- Sync daily via the automated cron job.
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 Point | Description |
|---|---|
| Daily cost (USD) | Total AI Gateway spend per day (aggregate) |
| Credit balance | Remaining credit balance at time of sync |
| Total credits used | Cumulative 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: Daily costs are computed from running totals, so the first day after integration will show the full cumulative balance as the initial data point.
Troubleshooting
"Test Connection" fails
- Check the token: Make sure you copied the full token without extra spaces.
- Token scope: Ensure the token has Full Account access.
- Token expiration: If the token has expired, create a new one in Vercel settings.
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.