Skip to main content

Adding Models

This section explains the steps to add Google Gemini models and configure the required access controls.
1

Navigate to Google Gemini Models in AI Gateway

From the TrueFoundry dashboard, navigate to AI Gateway > Models and select Google Gemini.
Navigating to Google Gemini Provider Account in AI Gateway

Navigate to Google Gemini Model

2

Add Google Gemini Account Details

Click Add Google Gemini Account. Give a unique name to your Gemini account and complete the form with your Gemini authentication details (API Key). Add collaborators to your account, this will give access to the account to other users/teams. Learn more about access control here.
Google Gemini account configuration form with fields for API key and collaborators

Google Gemini Model Account Form

3

Add Models

Select the model from the list. If you see the model you want to add in the list of checkboxes, we support public model cost for these models.
(Optional) If the model you are looking for is not present in the options, you can add it using + Add Model at the end of list (scroll down to see the option) by filling the form.

Inference

After adding the models, you can perform inference using an OpenAI-compatible API via the Playground or by integrating with your own application. Code Snippet and Try in Playgroud Buttons for each model

Supported APIs

Once your Gemini provider account is configured, the following API surfaces are available through the gateway.
Legend:
  • Supported by Provider and Truefoundry
  • Supported by Provider, but not by Truefoundry
  • Provider does not support this feature
Not supported for Gemini: Batch API, Files API, Messages API (Anthropic-only), Responses API, Speech-to-Text, Audio Translation, Moderation, Image Variation, and Realtime API. For Batch and Files workflows, use Google Vertex AI — same Gemini models, GCS-backed batch/files.
Gemini’s chat completions endpoint supports streaming, tools, multimodal input (images, audio, video, PDF), structured JSON outputs, extended thinking, and Google Search grounding. The gateway translates OpenAI-compatible requests into Gemini’s native generateContent API. Full provider capability matrix: Chat Completions API.
Python
Set stream=True and iterate over delta chunks. Defensively check that chunk.choices is non-empty and delta.content is not None.
Python
Advertise a tool, hand the model’s tool_calls back as a tool role message, then request the final response.
Python
Gemini accepts images, audio, video, and PDFs via multimodal content parts. Images use the image_url content type; audio and video also use image_url with a mime_type hint; PDFs use the file content type with a base64 data URI.
Python
Gemini supports two structured-output modes via response_format:
  • JSON object{"type": "json_object"} — guarantees valid JSON, no schema
  • JSON schema{"type": "json_schema", "json_schema": {...}} — enforces a schema
Python
Gemini 2.5 Pro and 2.5 Flash support extended thinking, on by default. Use reasoning_effort (low/medium/high) — the gateway translates it to Gemini’s native thinking-budget parameter.
Python
Gemini can augment responses with live Google Search results via a special google_search tool. The model decides when to invoke search during generation.
Python
Gemini’s TTS-preview models generate audio from text via the OpenAI-compatible /audio/speech endpoint. The gateway routes this to Google Cloud Text-to-Speech upstream. Full docs: Text-to-Speech.
Python
The gateway accepts OpenAI voice aliases (alloy, echo, fable, onyx, nova, shimmer) and translates them to default Cloud TTS voices. For specific Cloud TTS voices, pass the fully-qualified name (e.g. en-US-Chirp3-HD-Kore).
Gemini’s gemini-embedding-2 text embedding model via the OpenAI-compatible /embeddings endpoint. Accepts a task_type parameter via extra_body that tunes the vector for the downstream task (RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING). Full docs: Embed API.
Python
Gemini’s gemini-3.1-flash-image generates images from text via the OpenAI-compatible /images/generations endpoint. Full docs: Image Generation.
Python
Pricing varies by model family. Imagen models are billed per image at a flat rate. Gemini image models are billed per token, where higher-resolution / HD outputs consume more tokens.
Image edit uses the same gemini-3.1-flash-image model via the OpenAI-compatible /images/edits endpoint. Pass the source image and a mask.
Python
Gemini supports supervised fine-tuning of Gemini models. Upload JSONL via the Files API with purpose="fine-tune", then submit a tuning job through /fine_tuning/jobs. Lifecycle mirrors OpenAI fine-tuning. Full docs: Fine-tuning.
Fine-tuning incurs real GCP charges. See the Vertex tunable model list.
Python