Agent skill · writing content · sickn33

gemini-api-integration

Use when integrating Google Gemini API into projects. Covers model selection, multimodal inputs, streaming, function calling, and production best practices.

Why this skill is useful

Provides specific integration patterns and model selection guidance for the Google Gemini API that the AI wouldn't reliably generate on its own.

What it needs

Requires @google/generative-ai, google-generativeai installed locally. Requires google account access. About 3k tokens when loaded. Last updated 2026-08-07. 44,571 stars on the source repository.

What this skill does

Gemini API Integration Overview This skill guides AI agents through integrating Google Gemini API into applications — from basic text generation to advanced multimodal, function calling, and streaming use cases. It covers the full Gemini SDK lifecycle with production-grade patterns. When to Use This Skill Use when setting up Gemini API for the first time in a Node.js, Python, or browser project Use when implementing multimodal inputs (text + image/audio/video) Use when adding streaming responses to improve perceived latency Use when implementing function calling / tool use with Gemini Use when optimizing model selection (Flash vs Pro vs Ultra) for cost and performance Use when debugging Gemini API errors, rate limits, or quota issues Step-by-Step Guide 1. Installation & Setup Node.js / TypeScript: Python: Set your API key securely: 2. Basic Text Generation Node.js: Python: 3. Streaming Responses 4. Multimodal Input (Text + Image) 5. Function Calling / Tool Use 6. Multi-turn Chat 7. Model Selection Guide Model Best For Speed Cost ------- ---------- ------- ------ gemini-1.5-flash High-throughput, cost-sensitive tasks Fast Low gemini-1.5-pro Complex reasoning, long context Medium Medium gemini-2.0-flash Latest fast model, multimodal Very Fast Low gemini-2.0-pro Most capable, advanced tasks Slow High Best Practices ✅ Do: Use gemini-1.5-flash for most tasks — it's fast and cost-effective ✅ Do: Always stream responses for user-facing chat UIs to reduce perceived latency ✅ Do: Store API keys in environment variables, never hard-code them ✅ Do: Implement exponential backoff for rate limit (429) errors ✅ Do: Use systemInstruction to set persistent model behavior ❌ Don't: Use gemini-pro for simple tasks — Flash is cheaper and faster ❌ Don't: Send large base64 images inline for files > 20MB — use File API instead ❌ Don't: Ignore safety ratings in responses for production apps Error Handling Troubleshooting Problem: APIKEYINVALID error Solution: Ensure GEMINIAPIKEY environment …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills sickn33/gemini-api-integration--3e106b

View the source on GitHub

Browse the @skills marketplace