Skip to main content
Use Metrion as a proxy for Google Gemini. Because Metrion connects to Gemini’s OpenAI-compatible endpoint, you can use the standard OpenAI SDK — only the baseURL changes.
Metrion routes Gemini requests through Google’s OpenAI-compatible API endpoint (generativelanguage.googleapis.com/v1beta/openai/chat/completions). You use the OpenAI SDK, and Metrion handles the translation.

Prerequisites

  • A Metrion account with your sk-metrion-xxx token (find it on the Integrate page)
  • A Google Gemini API key saved in Metrion’s Integrate page

Setup

1
Install the OpenAI SDK
2
TypeScript
Python
3
Configure the client
4
Set baseURL to Metrion’s Gemini proxy and pass your sk-metrion-xxx token as apiKey. Metrion injects your Gemini key and forwards the request to Google’s API.
5
TypeScript
Python
6
Send a request
7
TypeScript
Python

Direct HTTP

Supported models

Pass-through mode

To use your own Gemini key without storing it in Metrion, pass it in Authorization: Bearer and identify your Metrion account with the x-metrion-token header:
In pass-through mode, your Gemini key is forwarded directly to Google’s API and is never stored by Metrion.

Track requests by user or service

Add the optional x-metrion-user header to tag individual requests. These labels appear in your Metrion logs and dashboards.
Use x-metrion-user to break down costs by team member, bot, or application — for example "x-metrion-user": "pipeline-rag" or "x-metrion-user": "user-12".