Google Gemini
Myra AI Workspace translates the OpenAI chat completions format to the Google GenerateContent API (used by both Google AI Studio and Vertex AI) and translates responses back.
Request translation
| OpenAI field | Gemini field | Notes |
|---|---|---|
messages[].role: "system" |
system_instruction.parts[].text |
Extracted and placed in the top-level system instruction |
messages[].role: "user" |
contents[].role: "user" |
|
messages[].role: "assistant" |
contents[].role: "model" |
Role name translated |
max_tokens |
generationConfig.maxOutputTokens |
|
temperature |
generationConfig.temperature |
|
top_p |
generationConfig.topP |
|
stream |
?alt=sse query param |
SSE pass-through |
| Image / document content blocks | — | Not forwarded. Replaced with a text placeholder |
System messages are extracted from the messages array and passed as the system_instruction top-level object.
⚠️ Caution: Vision and document input is not forwarded to Gemini. Image and document content blocks in a message are replaced with a text placeholder (for example,
[The user attached an image this model cannot view directly; the original image is retained by the system.]), so the model receives only the text parts. Native image support is a follow-up (media normalisation).
Web search
Gemini supports native web search through Google Search grounding. When a request carries a web_search tool, the gateway enables grounding by sending tools: [{ "googleSearch": {} }] in a single upstream leg; no separate search round-trip is performed. The grounded answer is returned in the normal response.
Tools and MCP connectors
Gemini has no gateway tool loop: the gateway does not run its two-leg tool loop (file access, URL fetch, knowledge search, code interpreter, MCP connector tools) against Gemini or Vertex, so on a Gemini model those tools are simply not offered and the turn is answered as plain chat (web search still works through the grounding described above).
MCP connector references (tools:[{"type":"mcp","connector_id":…}] — the web chat attaches every connected connector automatically) cannot run here either. In the web chat the turn is answered without the connectors: the chat shows that the connectors are not supported by this model, and the model is told not to claim it used one. An API request with connector references is rejected with model_capability_mismatch (HTTP 400; on a gateway whose PII scan has already opened the response stream, a terminal error event with that code inside the stream) rather than answered without them. To use the connectors, pick a model from a provider with a gateway tool loop (for example Anthropic, OpenAI, or the Myra-hosted models). See MCP connectors from the API.
Endpoint
Native endpoint
Compat endpoint
The compat endpoint routes to Gemini for any model whose name starts with gemini (case-insensitive):
with "model": "gemini-2.0-flash".
Adding a Google AI Studio API key
The gateway stores API keys using a bring-your-own-key (BYOK) mechanism. The key is sent in the x-goog-api-key request header on every upstream call.
Before you begin, ensure the following conditions are met:
- ☑ You have a Google AI Studio API key (starting with
AIza). - ☑ The gateway exists and is accessible.

Proceed as follows to add a Google AI Studio API key:
- Open Organisation › AI setup › Gateways.
- Click on the Open → button of the gateway.
- The gateway page opens on the Endpoint & keys tab.
- Locate the Provider Keys card.
- Click on the Add Model button.
- The Add Model page opens. Choose Use My Own Key (
…/models/new); Use Platform Key (…/models) enables Myra-provided models without a key of your own. - On a self-serve plan this page offers Discuss requirements instead of a key form: self-serve plans cannot store their own provider keys (see BYOK).
- The Add Model page opens. Choose Use My Own Key (
- Select gemini in the Provider drop-down list.
- Enter
defaultin the Alias text field, or a custom alias when storing multiple keys. - Enter the Google AI Studio API key (starting with
AIza) in the API Key field. - Click on the Store Key button.
-> The new entry appears in the Provider Keys list. The key is stored encrypted and is used for every Gemini request on this gateway.
To add the key via the API:
curl -s -X POST "https://gateway.example.com/admin/v1/gateways/{gateway_id}/keys" \
-H "Cookie: aig_admin=<SESSION>" \
-H "Content-Type: application/json" \
-d '{
"provider": "gemini",
"alias": "default",
"key": "AIza..."
}'
Request example
curl -s -X POST \
"https://gateway.example.com/v1/myapp/production/gemini/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"model": "gemini-2.0-flash",
"messages": [
{"role": "system", "content": "Reply only in haiku form."},
{"role": "user", "content": "Describe a sunset."}
],
"max_tokens": 128,
"temperature": 1.0
}'
Vertex AI variant
Vertex AI uses the same GenerateContent wire format but is reached at a per-project per-region URL on *-aiplatform.googleapis.com. See the dedicated Google Vertex AI page. The gateway authenticates Vertex AI requests with an OAuth2 Bearer token it mints from a Google Cloud service-account JSON credential (RFC 7523 JWT-bearer grant), sent as Authorization: Bearer.
Configuring Vertex AI
Before you begin, ensure the following conditions are met:
- ☑ You have a Google Cloud project with the Vertex AI API enabled.
- ☑ You have a Google Cloud service-account JSON key with access to the Vertex AI API.
Vertex AI requires vertex_project and (optionally) vertex_region to be set in the gateway configuration. The keys are not exposed in the gateway settings page of the SPA; set them through the admin API:
- Open Organisation › AI setup › Gateways.
- Send a
PATCHrequest to set the configuration:
curl -X PATCH "https://<your-gateway-host>/admin/v1/gateways/<ID>" \
-H "Content-Type: application/json" \
-d '{
"config": {
"vertex_project": "my-gcp-project-id",
"vertex_region": "us-central1"
}
}'
| Config field | Default | Description |
|---|---|---|
vertex_project |
unset | Google Cloud project ID. Required. |
vertex_region |
us-central1 |
Google Cloud region. |
💡 Note: Requests to the Vertex AI provider fail only when neither
vertex_projectnor a deployment-wide default project is set. The gateway authenticates with a Google Cloud service-account JSON credential, minting a short-lived OAuth2 Bearer token from it per service account (RFC 7523 JWT-bearer grant).
Store the service-account JSON through the Add Model page (select vertex in the Provider drop-down list and paste the entire service-account JSON). The gateway mints a short-lived OAuth2 access token from it and sends it as Authorization: Bearer on every upstream call.
Vertex AI request example
curl -s -X POST \
"https://gateway.example.com/v1/myapp/production/vertex/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"model": "gemini-2.0-flash",
"messages": [{"role": "user", "content": "Hello from Vertex AI"}],
"max_tokens": 256
}'
See also
- Providers overview
- Gateway configuration —
vertex_project,vertex_region