When making requests to Google AI Studio, you will need:
AI Gateway account ID
AI Gateway gateway name
Google AI Studio API key
Google AI Studio model name
URL structure
Your new base URL will use the data above in this structure: https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/.
Then you can append the endpoint you want to hit, for example: v1/models/{model}:{generative_ai_rest_resource}
So your final URL will come together as: https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/v1/models/{model}:{generative_ai_rest_resource}.
Examples
cURL
Use @google/generative-ai with JavaScript
If you are using the @google/generative-ai package, you can set your endpoint like this:
Was this helpful?
What did you like?
What went wrong?
Thank you for helping improve Cloudflare's documentation!