Hi RainX,
Since the same model works locally but Production returns byok_requires_paid_credits, I’d first rule out a team/env mismatch rather than focusing on Azure itself.
BYOK has two separate pieces:
The provider BYOK credential is scoped to a Vercel team, and the team still needs AI Gateway credits available even when BYOK is used. So if Production is using an AI Gateway key from a different team, or an older key created before the BYOK/credits setup was fixed, it could explain why getCredits() and generateText() behave differently than expected.
A clean test would be:
-
In the same Vercel team where the Azure BYOK key is configured, create a new AI Gateway API key.
-
Replace the Production AI_GATEWAY_API_KEY with that new key.
-
Redeploy the project, not just save the env var.
-
Trigger one request and check the new generationId.
Also make sure the deployed app is not accidentally using the Azure/OpenAI provider key directly as the Gateway auth token. Requests to AI Gateway should authenticate with the AI Gateway key, while the Azure credential should stay in the BYOK settings.
The Vercel BYOK docs mention the team-scoping and paid-credit requirement here:
https://vercel.com/docs/ai-gateway/authentication-and-byok/byok
If the new same-team Gateway key still produces providerAttemptCount: 0, then I’d include the generation ID and timestamp in a support follow-up, because that would point to the request being rejected before it reaches the provider.