Providers

Gemini API through an OpenAI-compatible gateway: cost tracking and budgets for Google Gemini

Call Google Gemini models with the OpenAI SDK through one gateway. Change base_url and the model name to gemini-*, then track Gemini spend per feature and cap it with budgets enforced before the call.

Any model name starting with gemini- is sent to Google's Gemini API using the key you store in Settings → AI Providers. Gemini exposes an OpenAI-compatible endpoint, so requests are forwarded without translation: streaming, tool calling and JSON output behave as they do on Gemini directly.

Setup

What works

EndpointNotes
Chat completionsStreaming with usage, tools, JSON output, image input
Responses APITranslated to chat for every provider. See Responses API
EmbeddingsGemini embedding models
Image generationimagen-3, imagen-4, translated to Imagen's native API; newer and less exercised than chat

Model names to watch

  • Only names starting with gemini- route to the Gemini API. Gemma models (gemma-...) route to Groq, which hosts them under the same name.
  • Gemini price changes (for example a long-context tier or a scheduled price change) are picked up by the daily price sync and reviewed before they apply, so historical calls keep the price they were made at.

Gemini or Vertex AI?

The Gemini API bills your Google AI Studio key. If your company buys Gemini through Google Cloud, use Vertex AI with a vertex/ model prefix so spend lands on your GCP project. You can connect both and choose per call.

Cap Gemini spend

Gemini Flash models are cheap per call, which makes runaway loops easy to miss until the bill arrives. A budget on the feature, plus the velocity circuit breaker on the proxy key, stops a loop within a minute instead of a month. See Budget enforcement.

On this page