Estimate the cost of one Gemini 4 agent run
estimate_agent_runTurn-by-turn cost of a Gemini 4 agent run: every turn re-sends the growing context as input, thinking tokens are billed at the output rate. Returns the rates in force on the chosen date, the simulated total, the naive first-turn × turns estimate and their multiplier. Before the 2026-12-01 price change it also returns afterIncrease: the same run priced at the announced 2026-12-01 rates.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"modelId": "<modelId>",
"thinkingLevel": "<thinkingLevel>",
"turns": "<turns>",
"initialContextTokens": "<initialContextTokens>",
"contextGrowthPerTurn": "<contextGrowthPerTurn>",
"userToolInputTokensPerTurn": "<userToolInputTokensPerTurn>",
"outputTokensPerTurn": "<outputTokensPerTurn>"
},
"name": "estimate_agent_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | ISO date (YYYY-MM-DD) that selects the price segment in force that day. Defaults to today (UTC). | |
| turns | Yes | Number of turns (separate API calls) in the run. | |
| modelId | Yes | Gemini 4 model to price. | |
| thinkingLevel | Yes | Thinking budget. Thinking tokens are billed at the output price: off = 0×, low ≈0.5×, medium ≈1.5×, high ≈3× the visible output tokens. | |
| outputTokensPerTurn | Yes | Visible answer tokens per turn, excluding thinking. | |
| contextGrowthPerTurn | Yes | Net history added after each completed turn; billed from turn 2 onward. | |
| initialContextTokens | Yes | System prompt, tool definitions and documents sent on turn 1. | |
| userToolInputTokensPerTurn | Yes | New user/tool content billed on top of the context each turn. |