Skip to content

Gemini apps through Kaeso, with Claude and GPT behind them

Apps written for the Gemini API, with the google-genai SDKs or plain REST calls, now use Kaeso as their base URL under /v1beta and reach any model in the project. How to switch an app, what works, and what Kaeso translates on the way.

Published
Reading time
2 min
Author
Kaeso Team
A pale gradient of deep and pale blue, in upright folds like a curtain, with a warm light in one corner

Kaeso has always spoken the formats apps are written in: OpenAI's Chat Completions and Responses, and Anthropic's Messages. With 0.6.0 it speaks Gemini's too. An app written with Google's google-genai SDKs, or with plain Gemini REST calls, uses Kaeso as its base URL and reaches every model in the project, from Gemini to Claude and GPT.

Switch an app in two lines

Give the client a Kaeso key and Kaeso's address. The SDK adds /v1beta on its own:

import osfrom google import genai client = genai.Client(    api_key=os.environ["KAESO_API_KEY"],    http_options={"base_url": "https://kaeso.example.com"},) response = client.models.generate_content(    model="claude-haiku-5-5",    contents="Write a haiku about gateways.",)print(response.text)

In TypeScript, with @google/genai:

import { GoogleGenAI } from "@google/genai"; const ai = new GoogleGenAI({  apiKey: process.env.KAESO_API_KEY,  httpOptions: { baseUrl: "https://kaeso.example.com" },}); const response = await ai.models.generateContent({  model: "claude-haiku-5-5",  contents: "Write a haiku about gateways.",});console.log(response.text);

The model is any model of the project's catalogue, or an alias. The SDK sends the key in x-goog-api-key, which Kaeso accepts like Authorization: Bearer.

What works

CallPath
GeneratePOST /v1beta/models/{model}:generateContent
StreamPOST /v1beta/models/{model}:streamGenerateContent?alt=sse
Count tokensPOST /v1beta/models/{model}:countTokens
EmbedPOST /v1beta/models/{model}:embedContent, :batchEmbedContents
List modelsGET /v1beta/models, GET /v1beta/models/{model}

Streams, thinking, tool calls, token counts, embeddings and model listings all work. Every error under /v1beta comes back in the Gemini format, so the SDK's own error handling keeps working. Other Gemini methods, such as batchGenerateContent, files or cached contents, get 404 rather than a half-working answer.

GET /v1beta/models lists the models the key may call, named models/<name> as the Gemini API names them, followed by the project's aliases that point at them, in pages of 50 with pageToken.

What Kaeso translates on the way

When a Gemini app calls Claude or GPT, Kaeso translates the request into that model's format and the answer back into Gemini's. A few details matter in practice:

  • Reasoning across tool calls. The Gemini format has no field for another provider's reasoning. Kaeso keeps the model's reasoning before each tool call and adds it back on the app's next turn, so an agent loop doesn't lose its thread.
  • Thought signatures. When a Gemini app calls a Gemini model, its thought signatures go back and forth unchanged. Kaeso calls Gemini models in their own format, so signatures survive tool loops in every app format, not only Gemini's.
  • Keepalives. After 15 seconds without output, Kaeso writes a keepalive. In the Gemini format that is a blank line, because google-genai reads every other line of a stream as JSON.
  • Media. Images that Gemini models make reach Gemini apps, and Gemini apps get audio replies from Chat Completions models.
  • What can't be translated is named. When a model has no equivalent for a field, Kaeso leaves it out and names it in the kaeso-left-out header, or adapts it and names it in kaeso-adapted. Nothing disappears silently.

Use it with your own proxy

Installs from the installer and the platform templates route /v1beta/ already. If Kaeso runs behind a reverse proxy of your own, route /v1beta/ to the gateway, next to /v1/. Kaeso streams Gemini replies only as server-sent events, so a stream without alt=sse gets 400; the SDKs always send it.

Google's own models, too

Two of the thirteen providers 0.6.0 built in are Google's: Google AI Studio, with an API key, and Gemini Enterprise Agent Platform, with an express mode API key or a service account key, which also reaches its Claude, partner and open models. Add either as a provider, and its models answer apps in every format, OpenAI's and Anthropic's included.

Next steps

By Kaeso Team

On this page

Own the gateway.Own the record.

curl -fsSLhttps://kaeso.app/install.sh | sh