Skip to content
Docs

Gemini-Compatible API

Lifeboat accepts Google’s Gemini API, so a Gemini SDK works against a private model with a base-URL change. Every engine serves it: requests are translated to Lifeboat’s chat API, routed by the same load balancer, and translated back.

Endpoint Notes
POST /v1beta/models/{model}:generateContent Text, images, system instructions, function calling, JSON output
POST /v1beta/models/{model}:streamGenerateContent Streaming. Add ?alt=sse for server-sent events; without it the response is a streamed JSON array, as Google serves it
POST /v1beta/models/{model}:countTokens An estimate, marked X-Lifeboat-Token-Count: estimated
POST /v1beta/models/{model}:embedContent and :batchEmbedContents Served by an embedding server
GET /v1beta/models The models Lifeboat is serving, in Gemini’s shape

The same routes are also accepted under /v1. {model} is the model’s name or alias as listed by /v1/models.

from google import genai
from google.genai import types
client = genai.Client(
api_key="<your Lifeboat API key>",
http_options=types.HttpOptions(base_url="https://<your-lifeboat>", api_version="v1beta"),
)
print(client.models.generate_content(model="<model alias>", contents="Hello").text)

The key is accepted as x-goog-api-key (what the SDKs send), as ?key=, or as Authorization: Bearer.

  • systemInstruction, contents (text, inline images, image URLs), generationConfig (temperature, topP, topK, maxOutputTokens, stopSequences, seed, penalties, JSON mode and response schemas) and tools with toolConfig.
  • thinkingConfig.thinkingBudget: 0 turns reasoning off on models that support switching it. A model’s reasoning is returned as parts marked thought: true.
  • Function calls are returned whole. In a stream, a function call arrives in the final chunk, once its arguments are complete.
  • A function response is matched to its call by name, as the Gemini API does.

Not provided: cached content, file upload, safety settings and grounding tools. Safety settings are accepted and ignored.