Vercel's AI SDK has a first-class OpenAI provider that accepts a baseURL. Configure it for AIgateway and every AI SDK feature — streamText, generateObject, tool calling — works against any of our 1000+ models.
Create a custom OpenAI client pointed at AIgateway and use it everywhere.