google-ai-studio
GoogleのAI StudioとGemini APIを活用し、テキスト、画像、動画、音声など多様なデータを扱えるAI機能で、長文の処理やコード生成、Google検索との連携、構造化された出力などを実現するSkill。
📜 元の英語説明(参考)
Google AI Studio and Gemini API for multimodal AI. Use when you need multimodal AI (text + image + video + audio), long context up to 1M tokens, code generation with Gemini, grounding with Google Search, or structured output with response schemas.
🇯🇵 日本人クリエイター向け解説
GoogleのAI StudioとGemini APIを活用し、テキスト、画像、動画、音声など多様なデータを扱えるAI機能で、長文の処理やコード生成、Google検索との連携、構造化された出力などを実現するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o google-ai-studio.zip https://jpskill.com/download/14953.zip && unzip -o google-ai-studio.zip && rm google-ai-studio.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14953.zip -OutFile "$d\google-ai-studio.zip"; Expand-Archive "$d\google-ai-studio.zip" -DestinationPath $d -Force; ri "$d\google-ai-studio.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
google-ai-studio.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
google-ai-studioフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Google AI Studio — Gemini API
概要
Google AI Studio は、API 経由で Gemini モデルファミリーへのアクセスを提供します。Gemini 2.0 Flash は、高頻度タスク向けの Google の最速モデルです。Gemini 1.5 Pro は、最大 100 万トークンのコンテキストウィンドウをサポートし、画像、音声、ビデオ、および PDF をネイティブに処理します。この API は、Google Search によるグラウンディング、構造化された JSON 出力、およびストリーミングをサポートしています。
セットアップ
# Python
pip install google-generativeai
# Node.js
npm install @google/generative-ai
export GOOGLE_API_KEY=AIza...
API キーは Google AI Studio から取得してください。
利用可能なモデル
| モデル | コンテキスト | 最適な用途 |
|---|---|---|
gemini-2.0-flash |
1M tokens | 高速、費用対効果が高い、大量処理 |
gemini-2.0-flash-thinking-exp |
1M tokens | 思考を伴う複雑な推論 |
gemini-1.5-pro |
2M tokens | 最長のコンテキスト、複雑なタスク |
gemini-1.5-flash |
1M tokens | バランスの取れた速度と能力 |
text-embedding-004 |
2048 input | テキスト埋め込み |
指示
基本的なテキスト生成
import google.generativeai as genai
genai.configure(api_key="AIza...") # または GOOGLE_API_KEY を読み込む
model = genai.GenerativeModel("gemini-2.0-flash")
response = model.generate_content("Explain neural networks in one paragraph.")
print(response.text)
複数ターンのチャット
import google.generativeai as genai
genai.configure(api_key="AIza...")
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
system_instruction="You are a Python expert. Always show working code examples.",
)
chat = model.start_chat()
response = chat.send_message("How do I read a CSV with pandas?")
print(response.text)
response = chat.send_message("Now show me how to filter rows where age > 30.")
print(response.text)
画像分析
import google.generativeai as genai
import PIL.Image
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
# ローカルファイルから
image = PIL.Image.open("screenshot.png")
response = model.generate_content(["What's in this image? List all visible text.", image])
print(response.text)
# URL から (インラインデータ)
import httpx
import base64
img_data = httpx.get("https://example.com/chart.png").content
image_part = {"mime_type": "image/png", "data": base64.b64encode(img_data).decode()}
response = model.generate_content(["Analyze this chart:", image_part])
print(response.text)
PDF 処理
import google.generativeai as genai
import pathlib
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-1.5-pro")
# PDF ファイルをアップロード
pdf_file = genai.upload_file(
path="report.pdf",
mime_type="application/pdf",
display_name="Annual Report 2024",
)
response = model.generate_content([
"Summarize the key financial metrics from this report.",
pdf_file,
])
print(response.text)
# インライン PDF (小さいファイル)
pdf_bytes = pathlib.Path("document.pdf").read_bytes()
import base64
pdf_part = {"mime_type": "application/pdf", "data": base64.b64encode(pdf_bytes).decode()}
response = model.generate_content(["Extract all dates and deadlines:", pdf_part])
print(response.text)
ストリーミング
import google.generativeai as genai
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
for chunk in model.generate_content("Write a short story about AI.", stream=True):
print(chunk.text, end="", flush=True)
print()
レスポンススキーマによる構造化された出力
import google.generativeai as genai
import json
genai.configure(api_key="AIza...")
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
generation_config={
"response_mime_type": "application/json",
"response_schema": {
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"founded": {"type": "integer"},
"country": {"type": "string"},
},
"required": ["name", "founded", "country"],
},
}
},
},
},
)
response = model.generate_content(
"List 3 major AI companies with their founding year and country."
)
data = json.loads(response.text)
print(data)
Google Search によるグラウンディング
import google.generativeai as genai
from google.generativeai import types
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
# Google Search グラウンディングを有効にする
response = model.generate_content(
"What are the latest AI research papers published this week?",
tools=[types.Tool(google_search=types.GoogleSearch())],
)
print(response.text)
# グラウンディングメタデータをチェック
if response.candidates[0].grounding_metadata:
for source in response.candidates[0].grounding_metadata.search_entry_point or []:
print(f"Source: {source}")
関数呼び出し
import google.generativeai as genai
genai.configure(api_key="AIza...")
def get_product_info(product_id: str) -> dict:
"""Simulated product lookup."""
return {"id": product_id, "name": "Widget Pro", "price": 49.99, "in_stock": True}
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
tools=[get_product_info], # Python 関数を直接渡す!
)
chat = model.start_chat(enable_automatic_function_calling=True)
response = chat.send_message("What's the price and availability of product P123?")
print(response.text)
# Gemini は自動的に get_product_info("P123") を呼び出し、結果を組み込みます
長いコンテキスト — コードベース全体の処理
import google.generativeai as genai
import pathlib
genai.configure(api_key="AIza...")
model = genai.GenerativeModel( 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Google AI Studio — Gemini API
Overview
Google AI Studio provides access to the Gemini family of models via API. Gemini 2.0 Flash is Google's fastest model for high-frequency tasks; Gemini 1.5 Pro supports up to 1 million token context windows and handles images, audio, video, and PDFs natively. The API supports grounding with Google Search, structured JSON output, and streaming.
Setup
# Python
pip install google-generativeai
# Node.js
npm install @google/generative-ai
export GOOGLE_API_KEY=AIza...
Get your API key from Google AI Studio.
Available Models
| Model | Context | Best For |
|---|---|---|
gemini-2.0-flash |
1M tokens | Fast, cost-efficient, high-volume |
gemini-2.0-flash-thinking-exp |
1M tokens | Complex reasoning with thoughts |
gemini-1.5-pro |
2M tokens | Longest context, complex tasks |
gemini-1.5-flash |
1M tokens | Balanced speed and capability |
text-embedding-004 |
2048 input | Text embeddings |
Instructions
Basic Text Generation
import google.generativeai as genai
genai.configure(api_key="AIza...") # or reads GOOGLE_API_KEY
model = genai.GenerativeModel("gemini-2.0-flash")
response = model.generate_content("Explain neural networks in one paragraph.")
print(response.text)
Multi-Turn Chat
import google.generativeai as genai
genai.configure(api_key="AIza...")
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
system_instruction="You are a Python expert. Always show working code examples.",
)
chat = model.start_chat()
response = chat.send_message("How do I read a CSV with pandas?")
print(response.text)
response = chat.send_message("Now show me how to filter rows where age > 30.")
print(response.text)
Image Analysis
import google.generativeai as genai
import PIL.Image
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
# From local file
image = PIL.Image.open("screenshot.png")
response = model.generate_content(["What's in this image? List all visible text.", image])
print(response.text)
# From URL (inline data)
import httpx
import base64
img_data = httpx.get("https://example.com/chart.png").content
image_part = {"mime_type": "image/png", "data": base64.b64encode(img_data).decode()}
response = model.generate_content(["Analyze this chart:", image_part])
print(response.text)
PDF Processing
import google.generativeai as genai
import pathlib
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-1.5-pro")
# Upload a PDF file
pdf_file = genai.upload_file(
path="report.pdf",
mime_type="application/pdf",
display_name="Annual Report 2024",
)
response = model.generate_content([
"Summarize the key financial metrics from this report.",
pdf_file,
])
print(response.text)
# Inline PDF (smaller files)
pdf_bytes = pathlib.Path("document.pdf").read_bytes()
import base64
pdf_part = {"mime_type": "application/pdf", "data": base64.b64encode(pdf_bytes).decode()}
response = model.generate_content(["Extract all dates and deadlines:", pdf_part])
print(response.text)
Streaming
import google.generativeai as genai
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
for chunk in model.generate_content("Write a short story about AI.", stream=True):
print(chunk.text, end="", flush=True)
print()
Structured Output with Response Schema
import google.generativeai as genai
import json
genai.configure(api_key="AIza...")
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
generation_config={
"response_mime_type": "application/json",
"response_schema": {
"type": "object",
"properties": {
"companies": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"founded": {"type": "integer"},
"country": {"type": "string"},
},
"required": ["name", "founded", "country"],
},
}
},
},
},
)
response = model.generate_content(
"List 3 major AI companies with their founding year and country."
)
data = json.loads(response.text)
print(data)
Grounding with Google Search
import google.generativeai as genai
from google.generativeai import types
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-2.0-flash")
# Enable Google Search grounding
response = model.generate_content(
"What are the latest AI research papers published this week?",
tools=[types.Tool(google_search=types.GoogleSearch())],
)
print(response.text)
# Check grounding metadata
if response.candidates[0].grounding_metadata:
for source in response.candidates[0].grounding_metadata.search_entry_point or []:
print(f"Source: {source}")
Function Calling
import google.generativeai as genai
genai.configure(api_key="AIza...")
def get_product_info(product_id: str) -> dict:
"""Simulated product lookup."""
return {"id": product_id, "name": "Widget Pro", "price": 49.99, "in_stock": True}
model = genai.GenerativeModel(
model_name="gemini-2.0-flash",
tools=[get_product_info], # Pass Python function directly!
)
chat = model.start_chat(enable_automatic_function_calling=True)
response = chat.send_message("What's the price and availability of product P123?")
print(response.text)
# Gemini automatically calls get_product_info("P123") and incorporates the result
Long Context — Process Entire Codebase
import google.generativeai as genai
import pathlib
genai.configure(api_key="AIza...")
model = genai.GenerativeModel("gemini-1.5-pro") # 2M token context
# Read entire codebase into context
files = list(pathlib.Path("./src").rglob("*.py"))
code_content = "\n\n".join([
f"# File: {f}\n{f.read_text()}" for f in files
])
response = model.generate_content([
"Analyze this codebase and identify security vulnerabilities:",
code_content,
])
print(response.text)
Text Embeddings
import google.generativeai as genai
genai.configure(api_key="AIza...")
# Single embedding
result = genai.embed_content(
model="text-embedding-004",
content="Machine learning transforms industries.",
task_type="retrieval_document",
)
print(f"Embedding dim: {len(result['embedding'])}") # 768
# Batch embeddings
texts = ["Hello world", "Machine learning", "AI systems"]
result = genai.embed_content(
model="text-embedding-004",
content=texts,
task_type="retrieval_document",
)
embeddings = result["embedding"] # List of 768-dim vectors
Task Types for Embeddings
| Task Type | Use When |
|---|---|
retrieval_document |
Embedding documents to be retrieved |
retrieval_query |
Embedding search queries |
semantic_similarity |
Comparing text similarity |
classification |
Text classification tasks |
Guidelines
gemini-2.0-flashis the best default for most tasks — fast, cheap, and capable.- Use
gemini-1.5-proonly when you need >1M token context or maximum quality. - Automatic function calling simplifies tool use — pass Python functions directly to
tools=. - Always specify
response_mime_type: "application/json"withresponse_schemafor structured output. - Google Search grounding adds latency but ensures responses reflect current web information.
- The File API supports uploading files up to 2GB; uploaded files are retained for 48 hours.
- Rate limits on the free tier are low (~15 RPM) — use an API key with billing for production.