[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6CT8ZF9F1SR4MPS1APAPNEF":3,"skill-same:01M6CT8ZF9F1SR4MPS1APAPNEF":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":58,"repositoryHtmlUrl":59,"repositoryHomepageUrl":59,"ownerHtmlUrl":60,"ownerBlogUrl":6,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M6CT8ZF9F1SR4MPS1APAPNEF","gemini-api-integration",null,"Use when integrating Google Gemini API into projects. Covers model selection, multimodal inputs, streaming, function calling, and production best practices.","Sam-06060\u002Fjarvis-assistant","Sam-06060","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F208600848?v=4","01M6CRKT7C7FXD21V6HXF293S0","Samson Frank Ganta","01M6CRKTBEKYFD8YX5Z1GT99EE",6,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fgemini-api-integration\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"api","gemini api integration","api integration","integration","gemini api","gemini","model selection","best practices","streaming","multimodal","Production","google","projects","model","function calling","use","community","selection","calling","safe","2026-11-10 10:12:30",false,"---\nname: gemini-api-integration\ndescription: \"Use when integrating Google Gemini API into projects. Covers model selection, multimodal inputs, streaming, function calling, and production best practices.\"\nrisk: safe\nsource: community\ndate_added: \"2026-03-04\"\n---\n\n# Gemini API Integration\n\n## Overview\n\nThis 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.\n\n## When to Use This Skill\n\n- Use when setting up Gemini API for the first time in a Node.js, Python, or browser project\n- Use when implementing multimodal inputs (text + image\u002Faudio\u002Fvideo)\n- Use when adding streaming responses to improve perceived latency\n- Use when implementing function calling \u002F tool use with Gemini\n- Use when optimizing model selection (Flash vs Pro vs Ultra) for cost and performance\n- Use when debugging Gemini API errors, rate limits, or quota issues\n\n## Step-by-Step Guide\n\n### 1. Installation & Setup\n\n**Node.js \u002F TypeScript:**\n```bash\nnpm install @google\u002Fgenerative-ai\n```\n\n**Python:**\n```bash\npip install google-generativeai\n```\n\nSet your API key securely:\n```bash\nexport GEMINI_API_KEY=\"your-api-key-here\"\n```\n\n### 2. Basic Text Generation\n\n**Node.js:**\n```javascript\nimport { GoogleGenerativeAI } from \"@google\u002Fgenerative-ai\";\n\nconst genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);\nconst model = genAI.getGenerativeModel({ model: \"gemini-1.5-flash\" });\n\nconst result = await model.generateContent(\"Explain async\u002Fawait in JavaScript\");\nconsole.log(result.response.text());\n```\n\n**Python:**\n```python\nimport google.generativeai as genai\nimport os\n\ngenai.configure(api_key=os.environ[\"GEMINI_API_KEY\"])\nmodel = genai.GenerativeModel(\"gemini-1.5-flash\")\n\nresponse = model.generate_content(\"Explain async\u002Fawait in JavaScript\")\nprint(response.text)\n```\n\n### 3. Streaming Responses\n\n```javascript\nconst result = await model.generateContentStream(\"Write a detailed blog post about AI\");\n\nfor await (const chunk of result.stream) {\n  process.stdout.write(chunk.text());\n}\n```\n\n### 4. Multimodal Input (Text + Image)\n\n```javascript\nimport fs from \"fs\";\n\nconst imageData = fs.readFileSync(\"screenshot.png\");\nconst imagePart = {\n  inlineData: {\n    data: imageData.toString(\"base64\"),\n    mimeType: \"image\u002Fpng\",\n  },\n};\n\nconst result = await model.generateContent([\"Describe this image:\", imagePart]);\nconsole.log(result.response.text());\n```\n\n### 5. Function Calling \u002F Tool Use\n\n```javascript\nconst tools = [{\n  functionDeclarations: [{\n    name: \"get_weather\",\n    description: \"Get current weather for a city\",\n    parameters: {\n      type: \"OBJECT\",\n      properties: {\n        city: { type: \"STRING\", description: \"City name\" },\n      },\n      required: [\"city\"],\n    },\n  }],\n}];\n\nconst model = genAI.getGenerativeModel({ model: \"gemini-1.5-pro\", tools });\nconst result = await model.generateContent(\"What's the weather in Mumbai?\");\n\nconst call = result.response.functionCalls()?.[0];\nif (call) {\n  \u002F\u002F Execute the actual function\n  const weatherData = await getWeather(call.args.city);\n  \u002F\u002F Send result back to model\n}\n```\n\n### 6. Multi-turn Chat\n\n```javascript\nconst chat = model.startChat({\n  history: [\n    { role: \"user\", parts: [{ text: \"You are a helpful coding assistant.\" }] },\n    { role: \"model\", parts: [{ text: \"Sure! I'm ready to help with code.\" }] },\n  ],\n});\n\nconst response = await chat.sendMessage(\"How do I reverse a string in Python?\");\nconsole.log(response.response.text());\n```\n\n### 7. Model Selection Guide\n\n| Model | Best For | Speed | Cost |\n|-------|----------|-------|------|\n| `gemini-1.5-flash` | High-throughput, cost-sensitive tasks | Fast | Low |\n| `gemini-1.5-pro` | Complex reasoning, long context | Medium | Medium |\n| `gemini-2.0-flash` | Latest fast model, multimodal | Very Fast | Low |\n| `gemini-2.0-pro` | Most capable, advanced tasks | Slow | High |\n\n## Best Practices\n\n- ✅ **Do:** Use `gemini-1.5-flash` for most tasks — it's fast and cost-effective\n- ✅ **Do:** Always stream responses for user-facing chat UIs to reduce perceived latency\n- ✅ **Do:** Store API keys in environment variables, never hard-code them\n- ✅ **Do:** Implement exponential backoff for rate limit (429) errors\n- ✅ **Do:** Use `systemInstruction` to set persistent model behavior\n- ❌ **Don't:** Use `gemini-pro` for simple tasks — Flash is cheaper and faster\n- ❌ **Don't:** Send large base64 images inline for files > 20MB — use File API instead\n- ❌ **Don't:** Ignore safety ratings in responses for production apps\n\n## Error Handling\n\n```javascript\ntry {\n  const result = await model.generateContent(prompt);\n  return result.response.text();\n} catch (error) {\n  if (error.status === 429) {\n    \u002F\u002F Rate limited — wait and retry with exponential backoff\n    await new Promise(r => setTimeout(r, 2 ** retryCount * 1000));\n  } else if (error.status === 400) {\n    \u002F\u002F Invalid request — check prompt or parameters\n    console.error(\"Invalid request:\", error.message);\n  } else {\n    throw error;\n  }\n}\n```\n\n## Troubleshooting\n\n**Problem:** `API_KEY_INVALID` error\n**Solution:** Ensure `GEMINI_API_KEY` environment variable is set and the key is active in Google AI Studio.\n\n**Problem:** Response blocked by safety filters\n**Solution:** Check `result.response.promptFeedback.blockReason` and adjust your prompt or safety settings.\n\n**Problem:** Slow response times\n**Solution:** Switch to `gemini-1.5-flash` and enable streaming. Consider caching repeated prompts.\n\n**Problem:** `RESOURCE_EXHAUSTED` (quota exceeded)\n**Solution:** Check your quota in Google Cloud Console. Implement request queuing and exponential backoff.\n","# Gemini API Integration\n\n## Overview\n\nThis 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.\n\n## When to Use This Skill\n\n- Use when setting up Gemini API for the first time in a Node.js, Python, or browser project\n- Use when implementing multimodal inputs (text + image\u002Faudio\u002Fvideo)\n- Use when adding streaming responses to improve perceived latency\n- Use when implementing function calling \u002F tool use with Gemini\n- Use when optimizing model selection (Flash vs Pro vs Ultra) for cost and performance\n- Use when debugging Gemini API errors, rate limits, or quota issues\n\n## Step-by-Step Guide\n\n### 1. Installation & Setup\n\n**Node.js \u002F TypeScript:**\n```bash\nnpm install @google\u002Fgenerative-ai\n```\n\n**Python:**\n```bash\npip install google-generativeai\n```\n\nSet your API key securely:\n```bash\nexport GEMINI_API_KEY=\"your-api-key-here\"\n```\n\n### 2. Basic Text Generation\n\n**Node.js:**\n```javascript\nimport { GoogleGenerativeAI } from \"@google\u002Fgenerative-ai\";\n\nconst genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);\nconst model = genAI.getGenerativeModel({ model: \"gemini-1.5-flash\" });\n\nconst result = await model.generateContent(\"Explain async\u002Fawait in JavaScript\");\nconsole.log(result.response.text());\n```\n\n**Python:**\n```python\nimport google.generativeai as genai\nimport os\n\ngenai.configure(api_key=os.environ[\"GEMINI_API_KEY\"])\nmodel = genai.GenerativeModel(\"gemini-1.5-flash\")\n\nresponse = model.generate_content(\"Explain async\u002Fawait in JavaScript\")\nprint(response.text)\n```\n\n### 3. Streaming Responses\n\n```javascript\nconst result = await model.generateContentStream(\"Write a detailed blog post about AI\");\n\nfor await (const chunk of result.stream) {\n  process.stdout.write(chunk.text());\n}\n```\n\n### 4. Multimodal Input (Text + Image)\n\n```javascript\nimport fs from \"fs\";\n\nconst imageData = fs.readFileSync(\"screenshot.png\");\nconst imagePart = {\n  inlineData: {\n    data: imageData.toString(\"base64\"),\n    mimeType: \"image\u002Fpng\",\n  },\n};\n\nconst result = await model.generateContent([\"Describe this image:\", imagePart]);\nconsole.log(result.response.text());\n```\n\n### 5. Function Calling \u002F Tool Use\n\n```javascript\nconst tools = [{\n  functionDeclarations: [{\n    name: \"get_weather\",\n    description: \"Get current weather for a city\",\n    parameters: {\n      type: \"OBJECT\",\n      properties: {\n        city: { type: \"STRING\", description: \"City name\" },\n      },\n      required: [\"city\"],\n    },\n  }],\n}];\n\nconst model = genAI.getGenerativeModel({ model: \"gemini-1.5-pro\", tools });\nconst result = await model.generateContent(\"What's the weather in Mumbai?\");\n\nconst call = result.response.functionCalls()?.[0];\nif (call) {\n  \u002F\u002F Execute the actual function\n  const weatherData = await getWeather(call.args.city);\n  \u002F\u002F Send result back to model\n}\n```\n\n### 6. Multi-turn Chat\n\n```javascript\nconst chat = model.startChat({\n  history: [\n    { role: \"user\", parts: [{ text: \"You are a helpful coding assistant.\" }] },\n    { role: \"model\", parts: [{ text: \"Sure! I'm ready to help with code.\" }] },\n  ],\n});\n\nconst response = await chat.sendMessage(\"How do I reverse a string in Python?\");\nconsole.log(response.response.text());\n```\n\n### 7. Model Selection Guide\n\n| Model | Best For | Speed | Cost |\n|-------|----------|-------|------|\n| `gemini-1.5-flash` | High-throughput, cost-sensitive tasks | Fast | Low |\n| `gemini-1.5-pro` | Complex reasoning, long context | Medium | Medium |\n| `gemini-2.0-flash` | Latest fast model, multimodal | Very Fast | Low |\n| `gemini-2.0-pro` | Most capable, advanced tasks | Slow | High |\n\n## Best Practices\n\n- ✅ **Do:** Use `gemini-1.5-flash` for most tasks — it's fast and cost-effective\n- ✅ **Do:** Always stream responses for user-facing chat UIs to reduce perceived latency\n- ✅ **Do:** Store API keys in environment variables, never hard-code them\n- ✅ **Do:** Implement exponential backoff for rate limit (429) errors\n- ✅ **Do:** Use `systemInstruction` to set persistent model behavior\n- ❌ **Don't:** Use `gemini-pro` for simple tasks — Flash is cheaper and faster\n- ❌ **Don't:** Send large base64 images inline for files > 20MB — use File API instead\n- ❌ **Don't:** Ignore safety ratings in responses for production apps\n\n## Error Handling\n\n```javascript\ntry {\n  const result = await model.generateContent(prompt);\n  return result.response.text();\n} catch (error) {\n  if (error.status === 429) {\n    \u002F\u002F Rate limited — wait and retry with exponential backoff\n    await new Promise(r => setTimeout(r, 2 ** retryCount * 1000));\n  } else if (error.status === 400) {\n    \u002F\u002F Invalid request — check prompt or parameters\n    console.error(\"Invalid request:\", error.message);\n  } else {\n    throw error;\n  }\n}\n```\n\n## Troubleshooting\n\n**Problem:** `API_KEY_INVALID` error\n**Solution:** Ensure `GEMINI_API_KEY` environment variable is set and the key is active in Google AI Studio.\n\n**Problem:** Response blocked by safety filters\n**Solution:** Check `result.response.promptFeedback.blockReason` and adjust your prompt or safety settings.\n\n**Problem:** Slow response times\n**Solution:** Switch to `gemini-1.5-flash` and enable streaming. Consider caching repeated prompts.\n\n**Problem:** `RESOURCE_EXHAUSTED` (quota exceeded)\n**Solution:** Check your quota in Google Cloud Console. Implement request queuing and exponential backoff.\n",{"name":5,"risk":48,"source":45,"date_added":54,"description":7},"2026-03-04","main","a50a3aa6b39fb0e1b7db88bef1bfc9c93606e126","modules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fgemini-api-integration",0,"https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant","https:\u002F\u002Fgithub.com\u002FSam-06060","Mobile Application Developer | Kotlin | Flutter, KMP, Swfit, Android,Swift UI | Building at Saar It Resources | Creator of Jarvis (AI Assistant)","2026-06-23 05:13:38",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add Sam-06060\u002Fjarvis-assistant --skill gemini-api-integration",{"tool":69,"command":70},"bunx","bunx skills add Sam-06060\u002Fjarvis-assistant --skill gemini-api-integration",{"tool":72,"command":73},"pnpm","pnpm dlx skills add Sam-06060\u002Fjarvis-assistant --skill gemini-api-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fgemini-api-integration\u002FSKILL.md",true,[],[78,89,105,132,151,177],{"skillNo":79,"name":80,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":86,"publishedAt":49},"01M6GDRVS6FXX3ESH0C9DW01C0","test_skill","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fscratch\u002Ftest_skill\u002FSKILL.md",[83],{"categoryNo":84,"categoryName":85,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",[87,88],"Test Skill","test",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":49},"01M6GDRQ40HX22MA6XWC31RHHK","zustand-store-ts","Create Zustand stores following established patterns with proper TypeScript types and middleware.","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fzustand-store-ts\u002FSKILL.md",[],[96,97,98,99,100,101,102,45,103,104],"zustand store ts","zustand","store","with","types","middleware","patterns","create","typescript",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":114,"publishedAt":49},"01M6GDRKEA0WE670SPFWX5GKCN","zoom-automation","Automate Zoom meeting creation, management, recordings, webinars, and participant tracking via Rube MCP (Composio). Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fzoom-automation\u002FSKILL.md",[111],{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[115,116,117,118,119,120,121,122,123,124,125,126,127,128,45,129,130,131],"automation","zoom automation","zoom","first","Tools","search","MCP","via","meeting","automate","critical","creation","webinars","composio","recordings","management","tracking",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":139,"publishedAt":49},"01M6GDRFS1452PC71JQ38S24HR","zoho-crm-automation","Automate Zoho CRM tasks via Rube MCP (Composio): create\u002Fupdate records, search contacts, manage leads, and convert leads. Always search tools first for current schemas.","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fzoho-crm-automation\u002FSKILL.md",[138],{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},[140,115,141,142,143,144,145,45,120,146,128,147,125,124,119,148,103,149,121,150],"crm automation","zoho crm","crm","zoho crm automation","zoho","leads","contacts","records","update","tasks","manage",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":160,"publishedAt":49},"01M6GDRCKQBAVTGHX5XBH26KPZ","zod-validation-expert","Expert in Zod — TypeScript-first schema validation. Covers parsing, custom errors, refinements, type inference, and integration with React Hook Form, Next.js, and tRPC.","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fzod-validation-expert\u002FSKILL.md",[157],{"categoryNo":158,"categoryName":159,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[161,162,163,164,165,104,48,166,167,168,169,170,99,171,172,173,174,45,175,176],"expert","zod","zod validation expert","validation","react","parsing","errors","schema validation","react hook form","hook","trpc","form","type","next","schema","Next.js",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":184,"publishedAt":49},"01M6GDR658B08K4MY0RWD4A6EH","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002FSam-06060\u002Fjarvis-assistant\u002Fblob\u002Fmain\u002Fmodules\u002Fagent_skills\u002Fawesome-skills\u002Fplaybooks\u002Fzeroize-audit\u002FSKILL.md",[183],{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},[185,186,187,188,189,190,191,192,45,193,194,195,196,197,198,199,200,201,202,121],"zeroize audit","audit","write","passwords","get","project","c++","activate","assembly","read","Bash","secrets","analysis","data","flow","verification","code","rust"]