Background
Google's Gemini API supports a "flex" service tier that offers a 50% discount on non-time-sensitive requests. It's a great fit for cron / batch / heartbeat jobs that don't need fast response.
OpenClaw already has serviceTier plumbing for OpenAI, Anthropic, and Minimax (via createOpenAIServiceTierWrapper, createAnthropicServiceTierWrapper, etc.), but no equivalent for the Google provider.
Current behavior (2026.5.4-beta.1, commit 9cc3ae1)
Setting a model as google/gemini-3.1-flash-lite-preview?serviceTier=flex in a cron payload (or anywhere a model ref is parsed):
normalizeStaticProviderModelId (model-ref-shared-CCa0R1eg.js:12-22) does not strip the query string — the entire gemini-3.1-flash-lite-preview?serviceTier=flex is treated as the model id.
- The allowlist check fails unless the literal
…?serviceTier=flex string is also added to agents.defaults.models.
- Even when allowlisted, Google returns either
404 Unknown Model or an empty response, since the literal model name doesn't exist.
So ?serviceTier=flex is currently a no-op syntactically — it isn't parsed anywhere, and there's no Google wrapper that would honor it.
Request
Add Google flex tier support, mirroring the existing OpenAI/Anthropic implementations:
- A
createGoogleServiceTierWrapper (analogous to createOpenAIServiceTierWrapper).
- Wire it into the Google provider stream composition (
provider-stream-…js).
- A configuration path — either:
- per-model option in
agents.defaults.models[<id>].serviceTier = "flex", or
- per-call override on cron payloads / agent turns, or
- the existing
?serviceTier=flex model-id query syntax, parsed centrally and stripped before the allowlist + provider call.
Workaround for users hitting this
Use bare model ids (no ?serviceTier=flex) — costs full standard tier but jobs run.
Background
Google's Gemini API supports a "flex" service tier that offers a 50% discount on non-time-sensitive requests. It's a great fit for cron / batch / heartbeat jobs that don't need fast response.
OpenClaw already has
serviceTierplumbing for OpenAI, Anthropic, and Minimax (viacreateOpenAIServiceTierWrapper,createAnthropicServiceTierWrapper, etc.), but no equivalent for the Google provider.Current behavior (2026.5.4-beta.1, commit 9cc3ae1)
Setting a model as
google/gemini-3.1-flash-lite-preview?serviceTier=flexin a cron payload (or anywhere a model ref is parsed):normalizeStaticProviderModelId(model-ref-shared-CCa0R1eg.js:12-22) does not strip the query string — the entiregemini-3.1-flash-lite-preview?serviceTier=flexis treated as the model id.…?serviceTier=flexstring is also added toagents.defaults.models.404 Unknown Modelor an empty response, since the literal model name doesn't exist.So
?serviceTier=flexis currently a no-op syntactically — it isn't parsed anywhere, and there's no Google wrapper that would honor it.Request
Add Google flex tier support, mirroring the existing OpenAI/Anthropic implementations:
createGoogleServiceTierWrapper(analogous tocreateOpenAIServiceTierWrapper).provider-stream-…js).agents.defaults.models[<id>].serviceTier = "flex", or?serviceTier=flexmodel-id query syntax, parsed centrally and stripped before the allowlist + provider call.Workaround for users hitting this
Use bare model ids (no
?serviceTier=flex) — costs full standard tier but jobs run.