Skip to content

Commit 4a4a652

Browse files
authored
Update vercel-ai-sdk.mdx
add instructions for how to use google ai studio w/ vercel ai sdk
1 parent e822350 commit 4a4a652

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/content/docs/ai-gateway/integrations/vercel-ai-sdk.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ const anthropic = createAnthropic({
3535
});
3636
```
3737

38+
### Google AI Studio
39+
40+
If you're using the Google AI Studio provider in AI SDK, you need to append `/v1beta` to your Google AI Studio-compatible AI Gateway URL to avoid errors. The `/v1beta` path is required because Google AI Studio's API includes this in its endpoint structure, and the AI SDK sets the model name separately. This ensures compatibility with Google's API versioning.
41+
42+
```typescript
43+
import { createGoogleGenerativeAI } from '@ai-sdk/google';
44+
45+
const google = createGoogleGenerativeAI({
46+
baseURL: `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/v1beta`,
47+
});
48+
```
49+
3850
### Other providers
3951

4052
For other providers that are not listed above, you can follow a similar pattern by creating a custom instance for any AI provider, and passing your AI Gateway URL. For help finding your provider-specific AI Gateway URL, refer to the [Supported providers page](/ai-gateway/providers).

0 commit comments

Comments
 (0)