403 error when using AI Gateway

I was prompted to load the credits for the AI gateway, so I bought credits and then wanted to use BYOK. I put in my key and got a 403 error. This is frustrating. update: never mind, I get a refund.

gen_01KVT8P7F52TF6K9T95DJK9KND

Hi mcl-apropos,

For the 403, I’d first separate the AI Gateway key from the provider BYOK key.

With BYOK, the request to AI Gateway should still use an AI Gateway API key in the Authorization header. The provider key should either be configured in the AI Gateway BYOK dashboard or passed through the request-scoped BYOK option, not used as the Gateway bearer token.

A quick isolation test would be:

curl -i https://ai-gateway.vercel.sh/v1/models \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY"

If that returns 403, I’d check that the key was created under the same Vercel team where the credits and BYOK provider credential were added. Vercel’s BYOK docs also note that the team still needs AI Gateway credits available even when using BYOK:

If /v1/models works but the generation request fails, then the next thing to check is the model/provider config and whether the BYOK credential passes “Test Key” in the dashboard.

The useful details to share would be the redacted 403 response body, timestamp, and generation ID. Don’t post the AI Gateway key or provider key.