Vercel AI Gateway billing credits instead of Claude Max subscription pass-through in Claude Code

Problem

I followed the guide for setting up Claude Code Max via AI Gateway (changelog link) to use my Claude Max subscription with pass-through.

Steps to Reproduce

  1. Set up my .zshrc with ANTHROPIC_BASE_URL and ANTHROPIC_CUSTOM_HEADERS exactly as documented
  2. Made sure ANTHROPIC_API_KEY was not set
  3. Ran claude /logout
  4. Sourced my environment (source ~/.zshrc)
  5. Re-authenticated in Claude Code using Option 1 (Claude account with subscription)
  6. Started prompting

Current Behavior

Within an hour, I got 403 errors for insufficient funds. Checked my dashboard and discovered my $15 in AI Gateway credits were completely drained. The pass-through to my Claude Max subscription didn’t work — requests were billed against my AI Gateway balance instead.

Expected Behavior

Requests should route through my Claude Max subscription without consuming AI Gateway credits.

(fyi, I am on the Hobby plan)

Also, I just tried again with a balance of $0 in AI Gateway - doing the full logout, add variables to env, source, login workflow. I get

  ⎿  API Error: 402 {"error":{"message":"Insufficient funds. Please add credits to your account to continue using AI services. Visit
     https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up to top up your credits.","type":"insufficient_funds"}}

In .zshrc:

export ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh"
export ANTHROPIC_CUSTOM_HEADERS="x-ai-gateway-api-key: Bearer [REDACTED :)]"
1 Like

Hi **dahlia**:waving_hand::sparkles:, I just noticed you’ve just joined the community a few hours ago — welcome! :tada:It’s super exciting to see new people here! :grinning_face_with_smiling_eyes:

It looks like your Claude Max subscription isn’t being used because your setup is pointing to Vercel AI Gateway, which always bills Vercel credits on the Hobby plan. That’s why you got the 402 / insufficient funds errors. use your Claude subscription directly:

export ANTHROPIC_API_KEY="sk-CLAUDE-MAX-YOUR-KEY"
export ANTHROPIC_BASE_URL="https://api.anthropic.com"

Remove the Vercel custom headers, source your .zshrc .zshrc .zshrc , and log in again. Now requests will go through your subscription, not your Vercel credits :money_with_wings: Vercel is moving fast :high_voltage::robot: feels like the perfect place to explore and share cool stuff! Some fun things you can also start small community topics like: