cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

cant get gemini-2.0-flash-exp with AI GATEWAY

Open Vikinghyx opened this issue 1 year ago • 3 comments

Existing documentation URL(s)

https://developers.cloudflare.com/ai-gateway/providers/google-ai-studio/

ERROR 404 not found when use: models/gemini-2.0-flash-exp https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/v1/models/{model}:{generative_ai_rest_resource}

What changes are you suggesting?

i wanna know how to use gemini-2.0

Additional information

No response

Vikinghyx avatar Jan 30 '25 11:01 Vikinghyx

Hey @Vikinghyx gemini-2.0-flash-exp is marked as beta in google studio, so you need to replace the v1/models with v1beta/models

The final url should look like this: https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/google-ai-studio/v1beta/models/{model}:{generative_ai_rest_resource}

G4brym avatar Feb 02 '25 16:02 G4brym

it works ! thanks

Vikinghyx avatar Feb 03 '25 05:02 Vikinghyx

so you need to replace the v1/models with v1beta/models

https://ai.google.dev/gemini-api/docs/api-versions

https://github.com/cloudflare/ai/blob/68aaf47e2f456b4976c6ec9ef79af1682650e03c/packages/ai-gateway-provider/test/endpoint.test.ts#L23

matijagrcic avatar Apr 07 '26 14:04 matijagrcic