I‘ve got AI gateway integrated with AI SDK and I’ve also added an OpenAI API key added to my org. I keep getting errors on my generations with an error message about rate limited free credits. But my understanding is that if I provide my own key, that should be used instead of the Vercel credits. Is there something else I should be doing to force my key to be used instead of the credits? I know my key is used sometimes because I can see the usage in the OpenAI dashboard. I’ve got plenty of credit there, so I shouldn’t be getting rate limited or using free credits at all. But it keeps happening every handful of calls.
Some extra info: if I take AI_GATEWAY_API_KEY out of .env and use the OpenAI provider directly with AI SDK the periodic errors go away. My local is using the same OpenAI API key as what I put into the AI Gateway integrations. Testing the key there works. From my POV, this seems like an AI Gateway issue.