google-ai-studio
БесплатноБез исполняемых скриптовНе проверенGoogle AI Studio and the Gemini API give programmatic access to Gemini models for multimodal (text, image, video, audio, PDF) generation, long context…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Google AI Studio — Gemini API
Overview
Google AI Studio is the web playground and API-key console for the Gemini API. In code you use the Google Gen AI SDK: google-genai for Python and @google/genai for JavaScript/TypeScript. The older google-generativeai (Python) and @google/generative-ai (JS) packages are deprecated since 30 November 2025 and no longer maintained, so do not start new code on them. Code written as genai.configure(...) / genai.GenerativeModel(...) belongs to the old SDK and must be ported (see Migration).
The API supports multimodal input, long context, streaming, structured output, function calling, Google Search grounding, file uploads and embeddings. Google also ships a newer Interactions API (client.interactions.create); client.models.generate_content remains the stable, widely documented entry point and is used below.
Setup
pip install google-genai # Python
npm install @google/genai # Node.js
export GEMINI_API_KEY=your-key-from-aistudio # GOOGLE_API_KEY also works
Create the key at https://aistudio.google.com/apikey. genai.Client() with no arguments reads the environment variable. If both GEMINI_API_KEY and GOOGLE_API_KEY are set, the SDK warns and prefers GOOGLE_API_KEY. Keep keys out of source control and never ship one in browser code.
Choosing a model
Model IDs and limits change every few months and old generations are retired or restricted to existing users. Before hard-coding an ID, read https://ai.google.dev/gemini-api/docs/models. The SDK README uses the alias gemini-flash-latest (always the newest Flash model), which is a safe default for prototypes; pin an exact stable ID in production so a model update cannot change behaviour. Gemini 1.5 and 2.0 IDs found in older tutorials are no longer the recommended choice.
| Need | Pick |
|---|---|
| Fast, cheap, high volume | A current Flash or Flash-Lite model |
| Hardest reasoning and coding | The current Pro model (often listed as preview) |
| Text embeddings | gemini-embedding-001 (text only) or gemini-embedding-2 (multimodal) |
Instructions
Basic generation and chat
from google import genai
from google.genai import types
client = genai.Client() # reads GEMINI_API_KEY
response = client.models.generate_content(
model="gemini-flash-latest",
contents="Explain neural networks in one paragraph.",
config=types.GenerateContentConfig(
system_instruction="You are a Python expert. Always show working code.",
temperature=0.3,
),
)
print(response.text)
chat = client.chats.create(model="gemini-flash-latest")
print(chat.send_message("How do I read a CSV with pandas?").text)
print(chat.send_message("Now filter rows where age > 30.").text)
Streaming
for chunk in client.models.generate_content_stream(
model="gemini-flash-latest",
contents="Write a 200-word story about a lighthouse keeper.",
):
print(chunk.text, end="", flush=True)
Images and PDFs
Small inputs go inline as types.Part.from_bytes; larger ones go through the File API.
import pathlib
image = types.Part.from_bytes(
data=pathlib.Path("dashboard.png").read_bytes(), mime_type="image/png"
)
r = client.models.generate_content(
model="gemini-flash-latest",
contents=["List all visible text and the three largest numbers.", image],
)
print(r.text)
# File API: required when the whole request would exceed 100 MB (PDFs: 50 MB)
report = client.files.upload(file="annual-report-2025.pdf")
r = client.models.generate_content(
model="gemini-flash-latest",
contents=["Summarize the key financial metrics.", report],
)
print(r.text)
Uploaded files are stored for 48 hours (up to 2 GB per file, 20 GB per project) and can be deleted earlier with client.files.delete(name=report.name).
Structured output
Pass a Pydantic model (or a JSON Schema via response_json_schema) and set the JSON MIME type. response.parsed returns the model instance.
from pydantic import BaseModel
class Company(BaseModel):
name: str
founded: int
country: str
r = client.models.generate_content(
model="gemini-flash-latest",
contents="List 3 major AI companies with founding year and country.",
config=types.GenerateContentConfig(
response_mime_type="application/json",
response_schema=list[Company],
),
)
for company in r.parsed:
print(company.name, company.founded, company.country)
Function calling
Passing a plain Python function with type hints and a docstring enables automatic function calling: the SDK calls it and returns the final text.
def get_order_status(order_id: str) -> dict:
"""Look up the shipping status of an order by its ID."""
return {"order_id": order_id, "status": "shipped", "eta": "2026-10-09"}
r = client.models.generate_content(
model="gemini-flash-latest",
contents="Where is order A-10432?",
config=ty
Установить google-ai-studio в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл google-ai-studio?
Google AI Studio and the Gemini API give programmatic access to Gemini models for multimodal (text, image, video, audio, PDF) generation, long context, structured JSON output, function calling and Google Search grounding. Use when asked to "call Gemini from Python or Node", "get a Gemini API key", "analyze a PDF or image with Gemini", "return JSON from Gemini", or "migrate from google-generativeai to google-genai".
Как установить скилл google-ai-studio?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл google-ai-studio запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic