
Gemini Interactions Api
Safely migrate existing Gemini generateContent-style code to the Interactions API and newer model generations without guessing project scope.
Install
npx skills add https://github.com/google-gemini/gemini-skills --skill gemini-interactions-apiWhat is this skill?
- Requires confirming migration scope before any edits when the user request is ambiguous
- Suggests ripgrep directory sizing to break down references by folder before asking
- Points to the official migrate-to-interactions guide for before/after examples across features
- Covers multi-turn, streaming, function calling, structured output, grounding, and multimodal paths
- Treats agent workflow as safe, incremental migration rather than blind project-wide rewrite
Adoption & trust: 4.2k installs on skills.sh; 3.6k GitHub stars; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
API migration is integration work on the product you are building, not launch marketing or ops monitoring. The skill is explicitly about swapping client calls, models, and feature flags in codebase references to Gemini APIs—classic backend/agent integration.
Common Questions / FAQ
Is Gemini Interactions Api safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Gemini Interactions Api
# Migration Reference How to migrate existing Gemini API code to the Interactions API and/or upgrade between model generations. Covers the agent workflow for performing migrations safely. For detailed before/after code examples across all feature areas (text generation, multi-turn, streaming, function calling, structured output, grounding, multimodal), fetch the full migration guide: https://ai.google.dev/gemini-api/docs/migrate-to-interactions.md.txt ## Confirm the Migration Scope **Before any edits, confirm the scope.** If the user's request does not explicitly name a single file, a specific directory, or an explicit file list, ask first and do not start editing. Even imperative requests like "migrate my code", "upgrade to gemini 3", or "switch to the Interactions API" leave the scope ambiguous. Ask: > Before I start editing, can you confirm the scope? > 1. Entire project > 2. Specific subdirectory (e.g. `src/`, `api/`) > 3. Specific file or list of files **Sizing the scope (large repos).** Before asking, get a per-directory count: ```sh rg -l "generate_content\|generateContent\|gemini-2\.0\|gemini-1\.5\|gemini-2\.5\|gemini-3-flash-preview\|thinking_budget\|temperature" --type-not md | cut -d/ -f1 | sort | uniq -c | sort -rn ``` Present the breakdown in your question (e.g. *"Found 42 references across 3 directories: src/ (28), tests/ (10), scripts/ (4). Which to migrate?"*). **Proceed without asking** only when the scope is already unambiguous, the user named an exact file ("migrate `app.py`"), pointed at a directory ("migrate everything under `src/`"), or already confirmed scope in an earlier turn. ## API Migration: `generateContent` → `Interactions` The core changes when migrating from `generateContent` to the Interactions API: | What | `generateContent` | Interactions API | |------|----------------|-----------------| | **SDK method** | `client.models.generate_content()` | `client.interactions.create()` | | **Response text** | `response.text` | `interaction.steps[-1].content[0].text` | | **Multi-turn** | Manual history array or `client.chats.create()` | `previous_interaction_id=interaction.id` | | **Streaming** | `generate_content_stream()` / `:streamGenerateContent` | `stream=True` + `step.delta` events | | **Structured output** | `config.response_format` inside `GenerateContentConfig` | Top-level `response_format` array | | **Function calling** | `candidates[0].content.parts[0].function_call` | `function_call` step in `interaction.steps` | | **Search grounding** | `groundingMetadata` on candidates | `google_search_call`/`google_search_result` steps + inline `annotations` | | **Config/types** | `types.GenerateContentConfig(...)`, `types.Tool(...)`, `types.Content(...)`, `types.Part.*` | Not used. Interactions API uses plain Python dicts and direct params. Check the feature docs for exact format. | | **REST endpoint** | `POST /v1beta/models/{model}:generateContent` | `POST /v1beta/interactions` | | **SDK package** | `google-genai` ≥ 1.x or legacy `google-generativeai` | `google-genai` ≥ 2.0.0 | For full before/after code examples, fetch the [Migration Guide](https://ai.google.dev/gemini-api/docs/migrate-to-interactions.md.txt) or read the Interactions API documentation pages for each feature. ## Model Migration ### Deprecated Models | Model | Status | Drop-in Replacement | |-------|--------|-------------------| | `gemini-2.0-flash` | Deprecated | `gemini-3.5-flash` | | `gemini-2.0-flash-lite` | Deprecated | `gemini-3.1-flash-lite-preview` | | `gemini-1.5-pro` | Deprecated | `gemini-3.5-flash` | | `gemini-1.5-flash` | Deprecated | `gemini-3.5-flash` | ### Active Legacy Models (migration recommended) | Current Model | Recommended Target | Why | |--------------|-------------------|-----| | `gemini-3-flash-preview` | `gemini-3.5-flash` | Latest Flash with Interactions API support | | `gemini-2.5-flash` | `gemini-3.5-flash` | Latest Flash with Interactions API support | | `gemini-2.5-pro` | `gemini-3.1-pro-pr