Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Google Gemini Api Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-google-gemini-api-knowledge-patch-nevaberry-plugins)
---
name: google-gemini-api-knowledge-patch
description: Google Gemini API
version: null
license: MIT
metadata:
author: Nevaberry
---
# Google Gemini API compatibility guidance
Load this skill when migrating Gemini API requests, model IDs, Interactions
consumers, function calls, SDK code, or billing and quota handling.
Use the topic references for complete endpoint details and language examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Models and lifecycle](references/models-and-lifecycle.md) | Model IDs, thinking, generation parameters, aliases, shutdowns, agents |
| [Interactions API](references/interactions-api.md) | Schema migration, conversation history, SSE, background work, logs |
| [Function calling and tools](references/function-calling-and-tools.md) | Declarations, results, MCP, grounding, code execution, Computer Use |
| [Thought signatures](references/thought-signatures.md) | Current-turn validation, parallel calls, compatibility API replay |
| [Structured outputs](references/structured-outputs.md) | Response formats, recursive schemas, tool combinations, validation |
| [SDK migration](references/sdk-migration.md) | Java, Go, JavaScript, TypeScript, Python, caching |
| [Media and Live](references/models-and-lifecycle.md#media-inputs-video-controls-and-live-sessions) | File inputs, video controls, Live sessions, streaming speech |
| [Billing and limits](references/billing-and-limits.md) | Tiers, spend caps, Prepay, throttling, Batch quota, pricing, regions |
## Breaking request and response changes
### Generation configuration
For `gemini-3.6-flash` and `gemini-3.5-flash-lite`, remove `temperature`,
`top_p`, and `top_k`: these releases ignore them, and future model generations
reject them with HTTP 400. Remove `candidate_count` for 3-series models.
For those two releases and future models, a last non-empty `model` turn causes
HTTP 400. Remove the trailing prefill and use Interactions `system_instruction`
to constrain the output.
For `gemini-3.8-flash`, replace `thinking_budget` with
`generation_config.thinking_level`: `low`, `medium` (default), or `high`.
Requests using `minimal` need a different level.
### Interactions schema and SDK cutover
Python and JavaScript SDK 2.0.0 and later use the new Interactions schema.
SDK 1.x Interactions calls break when the legacy schema is removed on June 8,
2026. On that date the API also starts ignoring `Api-Revision`.
- Read `interaction.steps` instead of `outputs`.
- Read `total_thought_tokens` instead of `total_reasoning_tokens`.
- A `model_output` step contains typed `content`; `thought` and `function_call`
are separate steps.
- The SDK exposes `output_text`, `output_image`, and `output_audio`.
- JavaScript Interactions uses snake_case, including `response_format`,
`mime_type`, `output_text`, and stream-event `event_type`.
- Use top-level `response_format` entries with a `type` discriminator.
Move JSON MIME type and schema into a text entry, image configuration into
an image entry, and audio output selection into `{"type": "audio"}`.
### Endpoint migrations
Fine-tuning support across the API ended with the last tunable model's shutdown.
Use [Models and lifecycle](references/models-and-lifecycle.md) for shutdown
dates, historical redirects, and the scope of each replacement recommendation.
| Requests using | Migration target |
| --- | --- |
| `gemini-2.0-flash`, `gemini-2.0-flash-001` | `gemini-3.6-flash` |
| `gemini-3-flash-preview` | `gemini-3.6-flash` |
| `gemini-2.5-pro` | `gemini-3.1-pro-preview` |
| `gemini-2.5-flash` | `gemini-3.6-flash` |
| `gemini-2.5-flash-lite` | `gemini-3.1-flash-lite` |
| `gemini-3.1-flash-lite` | `gemini-3.5-flash-lite` |
| `gemini-2.5-flash-image` | `gemini-3.1-flash-image` |
| `gemini-embedding-001`, `text-embedding-004` | `gemini-embedding-2` |
| `gemini-2.0-flash-live-001`, `gemini-live-2.5-flash-preview` | `gemini-3.1-flash-live-preview` |
The September 4, 2026 schedule lists no announced shutdown date for stable
2.5 Pro, Flash, or Flash-Lite. Some models expose lifecycle stage and deprecation
timelines; use those timelines, when available, to plan migrations.
## Function calls and history replay
Declare custom functions directly in `tools` with `type: "function"` and a JSON
Schema `parameters` object. `generation_config.tool_choice` accepts `auto`
(default), `any`, `none`, or preview `validated` schema enforcement. The nested
`allowed_tools` form restricts callable names. Very large or deeply nested
schemas can be rejected in `any` mode.
For third-generation models, put typed text and image blocks directly in
`function_result.result`. For a JSON result, serialize it into a text block:
```json
{"result": [{"type": "text", "text": "{\"status\": \"ready\"}"}]}
```
For stateless function calling, set `store=False` on each request. Preserve
every returned step unchanged, including `thought` and `function_call`, append
the function result, and send the full history as `input`.
When returning a custom result after built-in tools, `previous_interaction_id`
carries their context forward automatically.
For `generateContent`, include both `call_id` and `name` on every
`FunctionResponse`. When migrating function calling to `gemini-3.6-flash`, put
multimodal assets inside the function result payload and separate inline
instructions with a blank line (`\n\n`).
### Thought signatures
For 3-series calls, replay the original `thoughtSignature` on the first
`functionCall` part of every model step with calls in the current turn.
This includes sequential call chains and calls made with `minimal` thinking.
A `functionResponse`-only message keeps that turn open.
Keep parallel calls together in one model message, followed by all their results
in one user message. Interleaving calls with results causes HTTP 400.
For compatibility API calls, preserve `extra_content.google.thought_signature`
on the assistant tool call.
On 3-series responses without calls, retain a final signed part even if its text
is empty; replaying non-call signatures is optional. The reference covers
unsigned imported calls and the different optional replay rules for 2.5 models.
## Streaming Interactions
Set `stream: true`. Dispatch `interaction.created`, `step.start`, `step.delta`,
and `step.stop`; assemble steps by `index`, including content already supplied
in `step.start.step.content`.
- `interaction.completed` replaces `interaction.complete` and provides final
status and usage without assembled steps. The wire ends with `event: done`
carrying `[DONE]`.
- Read the ID from `interaction.id` on `interaction.created`. See the streaming
reference for the documented intermediate event shapes.
- For a function call, record opening `id` and `name`, append
`event.delta.arguments` for `arguments_delta`, and parse after `step.stop`.
An opening `step.arguments: {}` starts an empty string buffer.
- When completion reports `requires_action`, execute the function and send a
new interaction with its result and the ID from `interaction.created`.
- A `thought_summary` delta can contain text or an image. Check
`delta.content.type` before reading `delta.content.text`.
- Retain populated search `delta.signature` values; opening signatures can be
empty. Search query lists are in `delta.arguments.queries`.
- Log and skip unknown `event_type` and `delta.type` values so processing can
continue as new types are introduced.
## Structured output and tool combinations
For JSON, set a text `response_format` with `mime_type: "application/json"`
and `schema`. Recursive schemas can use `"$ref": "#"` for the root.
The supported subset includes `anyOf`, nullable type arrays, `prefixItems`,
boolean or schema-valued `additionalProperties`, numeric enums, and date/time
string formats.
Concatenate streamed text deltas and parse JSON after all fragments arrive.
Python can submit recursive Pydantic `model_json_schema()` output and validate
with the same model. JavaScript can build a validator with `z.fromJSONSchema()`.
Third-generation models support custom functions with a schema-constrained
final response. Combining `google_search` or `url_context` with such a response
is in preview. Code Execution and File Search also support constrained final
responses on third-generation models.
## Media, grounding, and Live sessions
File inputs can come from Cloud Storage or presigned URLs for public or private
databases; the file size limit increased from 20 MB to 100 MB.
Only `gemini-3.1-flash-image` supports video-to-image input from a directly
uploaded video or public YouTube URL alongside a text prompt.
File Search can embed and search images with `gemini-embedding-2`.
Grounding metadata exposes `media_id` for visual citations and `page_numbers`
for locating support. Built-in and custom function tools can share a request.
For Live reconnects, use the `session_resumption` handle; the server can retain
state for up to 24 hours. Sliding-window compression extends sessions beyond
the uncompressed context limit. `GoAway` provides notice before disconnection.
Automatic voice activity detection is adjustable or can be disabled in favor
of explicit `activityStart` and `activityEnd` signals.
## Billing and quota behavior
Projects inherit their billing account's tier and limits; all project keys
share its billing settings and spend. Monthly account caps pause every linked
project even when Prepay credit remains. Project caps can be exceeded by Batch
jobs, agent sessions, and billing data delays of up to about 10 minutes.
Paid usage may also encounter a rolling 10-minute spend throttle depending on
billing history and account standing. The ceilings are $10 for Tier 1, $50 for
Tier 2, and $200 for Tier 3. A breach returns `429 RESOURCE_EXHAUSTED` even with
request and token quota available; delay retries or reduce expensive-call rates.
Priority requests consume both interactive and separate Priority quota; the
default Priority limit is 30% of the standard interactive limit for that model
and tier. Batch jobs have separate quota, with enqueued-token ceilings applied
across all active jobs for a model.
Check active limits on AI Studio's **Rate Limit** page and the applied tier on
**Projects**. Tier upgrades can be denied on review despite meeting published
requirements. The Prepay purchase screen shows the minimum for the region and
tier. The billing documentation lists $5 or the local equivalent.