#Service tier for Google Gemini

1 messages ยท Page 1 of 1 (latest)

ornate mist
#

Does OpenClaw support service_tier for Google Gemini like OpenAI?

torn shadowBOT
fleet galleonBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> โœ… Mark Solution

torn shadowBOT
strong radishBOT
#

Not currently.

I checked the docs and provider code: OpenClaw maps serviceTier / service_tier for:

  • openai/*
  • openai-codex/*
  • anthropic/*

For direct google/* Gemini runs, the documented/provider-native extras are things like cachedContent and thinking controls, not service_tier, and the Google transport does not forward a Gemini service_tier field.

Docs:

So if you set params.serviceTier on google/gemini-*, it won't give you an OpenAI-style priority tier today.

#

If you want, I can help draft the exact GitHub feature request wording.

ornate mist
strong radishBOT
#

For a quick dirty hack, edit this file:

/home/exedev/openclaw-ref/extensions/google/transport-stream.ts

The key spots are:

  • GoogleGenerateContentRequest around line 60
  • buildGoogleGenerativeAiParams(...) around line 441

That function builds the JSON body sent to Gemini, so this is the place to inject a top-level service_tier.

Minimal hack:

type GoogleGenerateContentRequest = {
  service_tier?: string;
  cachedContent?: string;
#
  contents: Array<Record<string, unknown>>;
  generationConfig?: Record<string, unknown>;
  systemInstruction?: Record<string, unknown>;
  tools?: Array<Record<string, unknown>>;
  toolConfig?: Record<string, unknown>;
};

and then in buildGoogleGenerativeAiParams(...):

const params: GoogleGenerateContentRequest = {
  contents: convertGoogleMessages(model, context),
  service_tier: "priority", // or "flex"
};
#

If you only want it for some models, gate it there:

if (model.id.includes("gemini-3")) {
  params.service_tier = "priority";
}

If you want the slightly less dirty version, also add serviceTier?: string to GoogleTransportOptions near line 40, then map:

if (options?.serviceTier) {
  params.service_tier = options.serviceTier;
}

Useful companion test file: