Skip to navigation

The Google Gemini AI Studio connection sends requests to the Gemini API with a Gemini API key. Clients call the route with the OpenAI API format, which Gemini also accepts, and the gateway forwards each request unchanged, apart from the credentials. This topic lists what’s specific to Gemini. For the setup steps, see Connect an LLM provider. For Gemini models on Google Cloud, see Other providers.

Target URL

Use the base URL of Gemini’s OpenAI-compatible API, https://generativelanguage.googleapis.com/v1beta/openai.

Credentials

Enter a Gemini API key from Google AI Studio when you set up credentials. The gateway sends it to Google in the header that the provider catalog names, and replaces the same header if the client sent it. Callers authenticate to the gateway with their gateway key in fg-api-key.

Supported endpoints

MethodPathNotes
POST/chat/completionsSupports streaming.
POST/embeddings
GET/models

A request to a path that isn’t on this list gets 404.

Model names

Use Gemini model names, for example gemini-2.5-flash. The gateway sends the model field exactly as the client wrote it. If you restrict models on the connection, list the same names.

Example

curl "BASE_URL/chat/completions" \
-H "fg-api-key: GATEWAY_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash",
"messages": [{ "role": "user", "content": "Hello" }]
}'

Replace BASE_URL with the route’s base URL and GATEWAY_KEY with your gateway key. For how to find both, see Authenticate and send a request.

Next steps