// Model-lineage compat for "gemini"; regenerated from the frozen census using class taxonomy selectors.

class "gemini" {
	// Gemini ladders follow the model generation on every host: pre-3.0 keeps
	// the four-tier scale, Gemini 3+ Pro exposes only low/high, and the 3+
	// Flash/Lite lines keep the four-tier scale.
	family "pro" {
		// Replaces the Gemini 2.5+ Pro mandatory-reasoning fallback.
		revision ">=2.5 <3" {
			thinking-requires-effort #true
		}
		revision "<3" {
			thinking-efforts "minimal" "low" "medium" "high"
		}
		revision ">=3" {
			thinking-efforts "low" "high"
		}
	}
	family "flash" {
		revision ">=0" {
			thinking-efforts "minimal" "low" "medium" "high"
		}
	}
	family "lite" {
		revision ">=0" {
			thinking-efforts "minimal" "low" "medium" "high"
		}
	}
	// Direct Gemini 2.5 thinking budgets. Flash and Lite share the lower
	// documented ceiling; Pro keeps the full 32k high tier.
	on "google" "google-vertex" "opencode-zen" {
		family "pro" {
			revision ">=2.5 <2.6" {
				thinking-effort-budgets {
					minimal 128
					low 2048
					medium 8192
					high 32768
					xhigh 32768
					max 32768
				}
			}
		}
		family "flash" {
			revision ">=2.5 <2.6" {
				thinking-effort-budgets {
					minimal 128
					low 2048
					medium 8192
					high 24576
					xhigh 24576
					max 24576
				}
			}
		}
		family "lite" {
			revision ">=2.5 <2.6" {
				thinking-effort-budgets {
					minimal 128
					low 2048
					medium 8192
					high 24576
					xhigh 24576
					max 24576
				}
			}
		}
	}
	// Gemini 3.7+ Flash and Gemini 4 native thinkingLevel does not accept
	// `minimal` (400 THINKING_LEVEL_MINIMAL; observed on Flash 3.7 and 3.8, and
	// documented as a Gemini 4 change in Google's migration guide). Only the direct
	// google-level transports emit `thinkingLevel` on the wire, so the tier is
	// dropped there; budget (anthropic-messages) and reasoning_effort resellers
	// never send the rejected value and keep the four-tier ladder. The collapsed
	// google-antigravity / google-gemini-cli variants remap minimal -> LOW and
	// carry their own explicit ladder, so they are unaffected.
	// https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/start/get-started-with-gemini-4
	// https://ai.google.dev/gemini-api/docs/generate-content/thinking#thinking-levels
	on "google" "google-vertex" "opencode-zen" {
		family "flash" {
			revision ">=3.7" {
				thinking-efforts "low" "medium" "high"
			}
		}
		// Exact ids: a revision-wide rule would tie with the Pro low/high ladder.
		// Gemini API discovery infers `reasoning: false` for a Gemini 4 id with no
		// bundled reference; repair it so the ladder is selectable.
		models "gemini-4-argon" "gemini-4-argon-cyber-permissive" "gemini-4-carbon" {
			thinking-upgrade-neutral #true
			thinking-efforts "low" "medium" "high"
		}
	}
	// Gemini 4 Argon's and Carbon's introductory list price ($2/$10, $0.10
	// cached) ends 2026-11-30; from 2026-12-01 Google bills $4/$20, $0.20
	// cached, on the Gemini API and Vertex global endpoint alike. Cloud Billing
	// days start at midnight US Pacific. Both cards are pinned over whatever
	// stencil.so or the bundled pricing peer reports: the switch needs no
	// regeneration, and a row built after upstream catches up still prices
	// earlier requests at the introductory rate.
	// https://aistudio.google.com/docs/pricing
	// https://cloud.google.com/vertex-ai/generative-ai/pricing
	// https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-4-carbon-now-available/
	on "google" "google-vertex" "google-antigravity" {
		models "gemini-4-argon" "gemini-4-carbon" {
			cost-patch {
				input 2
				output 10
				cache-read 0.1
				cache-write 0
				effective-rates {
					list-price {
						effective-from "2026-12-01T08:00:00Z"
						input 4
						output 20
						cache-read 0.2
						cache-write 0
					}
				}
			}
		}
	}

	revision ">=3" {
		// Replaces the Google multimodal function-response baseline.
		multimodal-function-response #true
		// Replaces the Gemini 3+ mandatory-reasoning fallback.
		thinking-requires-effort #true
	}
	// Gemini 3+ takes `thinkingLevel` on the native Google transports; Gemini 4
	// rejects `thinkingBudget` outright (400 "Use thinking level instead").
	on-api "google-generative-ai" "google-gemini-cli" "google-vertex" {
		revision ">=3" {
			thinking-mode "google-level"
		}
	}
	// Public Gemini requires the bypass sentinel on every unsigned call and
	// supports function-part ids. Scope by adapter so custom providers using
	// the same wire protocol inherit both contracts. The Cloud Code Assist
	// first-call variant is a host contract in providers/.
	on-api "google-generative-ai" {
		revision ">=3" {
			requires-skip-thought-signature #true
			supports-function-part-id #true
		}
	}
	on "google-antigravity" "google-gemini-cli" {
		family "flash" {
			stream-first-event-timeout-ms 60000
			flash-stream-leak-workaround #true
		}
	}

	thinking-loop-guard "semantic"
}

// Google Search grounding is a Gemini 2+ lineage capability on every Gemini transport.
class "gemini" {
	on-api "google-generative-ai" "google-gemini-cli" {
		revision ">=2" {
			web-search "gemini"
			web-search-model "gemini-2.5-flash"
			image-model "gemini-3-pro-image"
		}
	}
}

// Gemini 3+ bills a fixed `media_resolution` budget per image regardless of
// pixels; the default for images is HIGH, 1,120 tokens.
// https://ai.google.dev/gemini-api/docs/media-resolution
class "gemini" {
	revision ">=3" {
		image-tokenization {
			regime "fixed"
			tokens 1120
		}
	}
}
