Skip to content
Back to skills

Google Gemini Api Knowledge Patch

ASecurity

Google Gemini API

  • 25 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 5, 2026
ai-agentsjavascriptpythongojavaapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill google-gemini-api-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Google Gemini Api Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Google Gemini Api Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-google-gemini-api-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-google-gemini-api-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: google-gemini-api-knowledge-patch
description: Google Gemini API
version: null
license: MIT
metadata:
  author: Nevaberry
---



# Google Gemini API Knowledge Patch

Load this skill when migrating Gemini API integrations, selecting model endpoints,
implementing Interactions streams or tool calls, generating structured or media
outputs, or diagnosing quota and billing behavior.

## Reference index

| Reference | Topics |
| --- | --- |
| [Models, media, and lifecycle](references/models-media-and-lifecycle.md) | Model migrations, thinking, files, images, video, embeddings, Live audio, transcription, music, grounding, agents, robotics |
| [Interactions API](references/interactions-api.md) | Schema migration, typed steps, history, SSE, output formats, background work, webhooks, logs |
| [Function calling and signatures](references/function-calling-and-signatures.md) | Tool declarations, choice, results, streaming calls, MCP, signature replay |
| [Structured outputs](references/structured-outputs.md) | JSON Schema, recursive schemas, tool combinations, streamed JSON, Python, JavaScript, Java |
| [Gen AI SDK migration](references/genai-sdk-migration.md) | SDK availability, Java dependency, Go field types and streams, JavaScript schemas, Python images and caching |
| [Limits and billing](references/limits-and-billing.md) | Tiers, spend caps, Prepay, Postpay, rate limits, batch quotas, pricing |

## Breaking request and configuration changes

Remove `candidate_count` when migrating to a 3-series model; these models do not
support it. 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.

For those two releases and future models, a last non-empty `model` turn causes
HTTP 400. Remove the trailing prefill and constrain output with an Interactions
`system_instruction`.

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.

For `gemini-3.6-flash`, use `thinking_level` set to `medium` or `high`.
For `gemini-3.5-flash-lite`, keep `minimal` for high-volume extraction or routing;
use `medium` or `high` for multi-step tool workflows.

The v1beta Interactions usage field is `total_thought_tokens`, renamed from
`total_reasoning_tokens`.

## Endpoint migration

Fine-tuning support across the API ended when the last tunable model shut down.
The API also ended support for 1.0 Pro and shut down the 1.5 Pro, Flash-8B, and
Flash endpoints. Detailed dates and scheduled shutdowns are in the model reference.

| Requests using | Migration destination |
| --- | --- |
| `gemini-3-flash-preview`, `gemini-2.0-flash`, `gemini-2.0-flash-001` | `gemini-3.6-flash` |
| `gemini-2.5-pro-preview-03-25`, `gemini-2.5-pro-preview-05-06`, `gemini-2.5-pro-preview-06-05` | `gemini-3.1-pro-preview` |
| `gemini-2.5-flash-lite-preview-09-2025` | `gemini-3.1-flash-lite` |
| `gemini-3.1-flash-lite` | `gemini-3.5-flash-lite` |
| `gemini-2.5-flash-image`, Imagen 4 endpoints | `gemini-3.1-flash-image` |
| `gemini-2.0-flash-live-001`, `gemini-live-2.5-flash-preview` | `gemini-3.1-flash-live-preview` |
| `gemini-embedding-001`, `text-embedding-004` | `gemini-embedding-2` |

The earliest announced shutdown dates are May 7, 2027 for
`gemini-3.1-flash-lite` and May 14, 2028 for `gemini-embedding-001`.
The September 4, 2026 schedule lists no announced shutdown date for stable
`gemini-2.5-pro`, `gemini-2.5-flash`, or `gemini-2.5-flash-lite`.

## Interactions schema and history

Python and JavaScript SDK 2.0.0 and later use the new Interactions schema.
The legacy schema was scheduled for removal on June 8, 2026, when SDK 1.x
Interactions calls break and the API starts ignoring `Api-Revision`.
The reference preserves the opt-in and opt-out headers for the cutover.

Read `interaction.steps` instead of `outputs`. A `model_output` step contains
typed blocks in `content`; `thought` and `function_call` are separate steps.
The SDK offers `interaction.output_text`, `interaction.output_image`, and
`interaction.output_audio` for direct access.

Create responses contain output steps; `GET /interactions/{id}` also includes
the initial `user_input` step. For client-managed history, retain original user
inputs alongside returned steps, then append the new `user_input` in `input`.
For server-side history, pass the preceding interaction's `id` as
`previous_interaction_id` and send the new user turn as `input`.

JavaScript Interactions fields use snake_case, including `response_format`,
`mime_type`, and `output_text`. Stream event names are in `event.event_type`.

## Step streaming

Set `stream: true`. Handle `interaction.created`, `step.start`, `step.delta`,
and `step.stop`, assembling steps by `index`. Include content already delivered
in `step.start.step.content`.

`interaction.completed` replaces `interaction.complete` and supplies final
status and usage without assembled steps. On the wire, `event: done` carries
`[DONE]`. Read the created ID from `interaction.id`. Intermediate event names
and fields are documented in the streaming reference.

Read final status from `event.interaction.status`. Handle `error.code` and
`error.message`. When present on `step.stop`, `usage` is cumulative and
`step_usage` is for that step. Log and skip unknown `event_type` and `delta.type`
values so the consumer can continue.

For streamed function calls, record the opening `id` and `name`, append
`event.delta.arguments` for `arguments_delta` events, and parse after `step.stop`.
An opening `step.arguments: {}` requires an empty string buffer.
On final `requires_action`, execute the function and return a `function_result`
using `previous_interaction_id`.

Set `generation_config={"thinking_summaries": "auto"}` for thought summaries.
A `thought_summary` delta can contain text or an image; inspect
`delta.content.type` before reading `delta.content.text`.
Capture `delta.signature` from the final `thought_signature` delta; a signature
can also be carried on the opening thought step.

## Function results and signature replay

Declare custom tools with `type: "function"` and JSON Schema `parameters`.
`generation_config.tool_choice` supports `auto` (default), `any`, `none`, and
`validated` (preview schema enforcement). Use nested `allowed_tools` to restrict
callable names. Very large or deeply nested schemas can be rejected in `any` mode.

Put typed blocks directly in the `function_result.result` array. Serialize JSON
results into text blocks; on third-generation models, inline images carry
`mime_type` and base64 `data`. For `generateContent`, every `FunctionResponse`
needs both `call_id` and `name` to identify the originating call.

For stateless function calling, set `store=False` on every request and append
all returned steps unchanged, including `thought` and `function_call`, followed
by the `function_result`. When built-in tools also ran, use
`previous_interaction_id` to carry their context forward automatically.

The 3-series validator scans back to the latest user message with ordinary
content; a `functionResponse`-only message keeps the current turn open.
Replay the original `thoughtSignature` on the first `functionCall` part of each
model step with calls in that turn, including sequential steps and `minimal`
thinking. Keep parallel calls in one model message and their results in one
user message; interleaving calls with results causes HTTP 400.

Through the compatibility API, preserve
`extra_content.google.thought_signature` on the assistant tool call.
The reference covers unsigned imported traces, optional non-call signatures,
and the different 2.5-series placement rules.

## Structured and multimodal output

Use top-level `response_format` with a `type` discriminator, or an array of
entries for multiple modalities. For JSON, put `mime_type: "application/json"`
and `schema` on the text entry. Move `generation_config.image_config` fields
into an image entry; replace `response_modalities=["audio"]` with
`{"type": "audio"}`. Set voice with
`generation_config={"speech_config": [{"voice": "Kore"}]}`.

Recursive schemas can use `"$ref": "#"` to reference the root.
The supported subset includes `anyOf`, nullable type arrays, `prefixItems`,
boolean or schema-valued `additionalProperties`, numeric enums, and date/time
string formats. For streamed JSON, concatenate text deltas and parse once all
fragments have arrived.

Third-generation models support schema-constrained final responses with custom
functions. The combination with `google_search` and `url_context` is in preview;
Code Execution and File Search also support schema-constrained final responses.

With `response_format=[{"type": "text"}, {"type": "image"}]` and streaming,
text and images can share a `model_output` step. Dispatch by `delta.type` and
decode image base64 `data` using `mime_type`.

## SDK and operational details

Replace the legacy Java `generativeai` artifact with `com.google.genai:google-genai`.
Java `outputText()` returns `Optional<String>`. Java Interactions requests use
`CreateInteractionRequestBody.of(...)`; close streaming `response.events()`
with try-with-resources.

Go generation settings belong in per-call `*genai.GenerateContentConfig`.
`Seed` uses `genai.Ptr[int32]`; assign `MaxOutputTokens` directly.
`Temperature`, `TopP`, `TopK`, `PresencePenalty`, and `FrequencyPenalty` take
`*float32`, including whole-number `TopK` values.

Batch quota is separate: 100 concurrent batch requests, 2 GB per input file,
and 20 GB file storage. Enqueued-token ceilings apply across active jobs for
the same model and vary by model and tier. Use webhooks for Batch jobs and
long-running operations to replace status polling.

Priority requests consume both interactive and separate Priority quota; the
default Priority limit is 30% of the standard limit for the same model and tier.
Spend throttling can return `429 RESOURCE_EXHAUSTED` even with request and token
quota available. Delay retries or reduce the rate of expensive calls.

Projects inherit their billing account's tier and rate limits. Account monthly
caps pause service across its projects even when Prepay credit remains.
Batch jobs, agent sessions, and billing data delays can push costs past a
project cap. HTTP 400 and 500 responses count against request quota but incur
zero token charges; `GetTokens` calls are free and consume zero inference quota.

Files in this skill

  • SKILL.md8.7 KB
  • coverage.json1.2 KB
  • references/function-calling-and-signatures.md6 KB
  • references/genai-sdk-migration.md3.9 KB
  • references/interactions-api.md5 KB
  • references/limits-and-billing.md4.4 KB
  • references/models-media-and-lifecycle.md5.1 KB
  • references/structured-outputs.md1.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.