/ai-gateways:gemini-3-profrom Multi-Model Gateways
Provides access to Google AI (Gemini) API for text generation with 2M context, embeddings, TTS, grounding, and structured output. Useful for autonomous agents and multimodal understanding.
Ships in Multi-Model Gateways. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
⚠️ NO-KEY GUARD (обязательно): этот функционал требует ОПЦИОНАЛЬНОГО стороннего API-ключа. Перед вызовом проверь ключ в
.credentials.master.env. Если ключ отсутствует, пустой или placeholder (your_*_api_key) — НЕ проси пользователя оплатить счёт, включить биллинг или купить API. Скажи одной строкой: «Эта функция опциональна и требует свой API-ключ (например, бесплатный ключ на aistudio.google.com); из коробки всё остальное работает по подписке Claude» — и предложи альтернативу или продолжай без неё.
See Also:
- image-generation — генерация картинок (канон NB2/Lite/Pro)
- nano-banana-pro — prompt engineering для Gemini image
- video-generation — генерация видео (Veo/Sora/Seedance)
- openai-dalle — OpenAI suite: gpt-image-2, Sora, Whisper, TTS
- autonomous-agent-creator — живой каталог моделей + discovery curl + OpenAI-shim для ботов
Скилл для Google AI (Gemini) API — то, что Opus/Fable не делают сами:
gemini-embedding-001⚠️ НЕ здесь: генерация картинок и видео. Канон — config/models.md:
картинки → skill image-generation (NB2 gemini-3.1-flash-image-preview default / NB2 Lite / NB Pro),
видео → skill video-generation (veo-3.1-generate-preview; ⚠️ sora-2* и весь Videos API OpenAI выключаются 24.09.2026 без замены).
Запрещённые модели (gemini-2.0-flash*, gemini-2.5-flash-image, gemini-pro-vision, gemini-1.x) — rules/dont-do.md.
# Ключи: ~/.claude/.credentials.master.env
# Канон: GOOGLE_API_KEY (GEMINI_API_KEY конфликтует с SDK при image-генерации)
import os
os.environ.pop('GEMINI_API_KEY', None) # снять конфликт SDK
api_key = os.getenv('GOOGLE_API_KEY')
pip install google-genai
from google import genai
from google.genai import types
client = genai.Client(api_key=os.getenv('GOOGLE_API_KEY'))
⛔ Старый SDK google.generativeai (import google.generativeai as genai, genai.configure(...), GenerativeModel) ЗАПРЕЩЁН (rules/dont-do.md п.9). Только from google import genai.
| Модель | Контекст | Роль |
|---|---|---|
gemini-3.1-pro-preview | ~2M | Лучший reasoning / длинные документы (всё ещё старший Pro) |
gemini-3-flash-preview | ~1M | Рекомендованный primary для ботов (быстрый, дешёвый) |
gemini-2.5-flash-lite | ~1M | Самый дешёвый, простые Q&A/классификация |
gemini-2.5-pro / gemini-2.5-flash | 1M | Стабильные fallback |
gemini-embedding-001 | — | Embeddings |
gemini-3.1-flash-tts-preview | — | TTS (дрейфует — сверяй через discovery) |
gemini-3.7-flash(вышел 13.08.2026) иgemini-3.8-flash— оба ID есть вmodels.listна 17.09.2026. Google называет их лучшими для воссоздания UI по скриншоту. Там же ужеgemini-3.5-flashиgemini-3.6-flash, которых нет в таблице выше: таблицу перед выбором primary для бота сверить заново (config/models.md).
Каталог дрейфует между ключами и релизами — перед хардкодом модели в конфиг прогони discovery:
curl -s "https://generativelanguage.googleapis.com/v1beta/models?key=${GOOGLE_API_KEY}" | python -m json.tool
Полная таблица (latency/лимиты/прайс/gotchas) — autonomous-agent-creator/references/gemini-api-models.md.
def gemini_chat(prompt: str, system: str | None = None,
model: str = "gemini-3-flash-preview") -> str:
response = client.models.generate_content(
model=model,
contents=prompt,
config=types.GenerateContentConfig(system_instruction=system),
)
return response.text
result = gemini_chat("Explain quantum computing",
model="gemini-3.1-pro-preview") # когда нужно качество/2M
В Claude Code текст/код/reasoning делают Opus/Fable по подписке — Gemini-текст нужен для автономных ботов, кросс-валидации (skill
multi-model-gateway) и 2M-контекста.
from PIL import Image
def analyze_image(image_path: str, prompt: str) -> str:
img = Image.open(image_path)
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=[prompt, img], # можно несколько картинок списком
)
return response.text
import time
def analyze_file(file_path: str, prompt: str,
model: str = "gemini-3.1-pro-preview") -> str:
"""Видео, аудио, PDF, большие документы (2M контекст)."""
f = client.files.upload(file=file_path)
while f.state == "PROCESSING":
time.sleep(2)
f = client.files.get(name=f.name)
response = client.models.generate_content(model=model, contents=[prompt, f])
return response.text
def transcribe_audio(audio_path: str) -> str:
return analyze_file(audio_path,
"Transcribe this audio accurately. Include speaker labels.")
def analyze_youtube(url: str, prompt: str) -> str:
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=types.Content(parts=[
types.Part(file_data=types.FileData(file_uri=url)),
types.Part(text=prompt),
]),
)
return response.text
import json
def structured_output(prompt: str, schema: dict) -> dict:
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=prompt,
config=types.GenerateContentConfig(
response_mime_type="application/json",
response_schema=schema, # или Pydantic-модель
),
)
return json.loads(response.text)
# Streaming
for chunk in client.models.generate_content_stream(
model="gemini-3-flash-preview", contents=prompt):
print(chunk.text, end="")
# Multi-turn chat
chat = client.chats.create(
model="gemini-3-flash-preview",
config=types.GenerateContentConfig(system_instruction="You are a coding assistant."),
)
r1 = chat.send_message("Write a Python function to sort a list")
r2 = chat.send_message("Now add type hints")
def grounded(query: str):
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=query,
config=types.GenerateContentConfig(
tools=[types.Tool(google_search=types.GoogleSearch())],
),
)
return {
"text": response.text,
"grounding": response.candidates[0].grounding_metadata,
}
def execute_code(prompt: str) -> str:
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=prompt,
config=types.GenerateContentConfig(
tools=[types.Tool(code_execution=types.ToolCodeExecution())],
),
)
for part in response.candidates[0].content.parts:
if getattr(part, "executable_code", None):
print("CODE:", part.executable_code.code)
if getattr(part, "code_execution_result", None):
print("RESULT:", part.code_execution_result.output)
return response.text
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents=f"Summarize: https://example.com/article",
config=types.GenerateContentConfig(
tools=[types.Tool(url_context=types.UrlContext())],
),
)
def get_weather(city: str) -> str:
"""Get current weather for a city."""
...
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents="Погода в город?",
config=types.GenerateContentConfig(tools=[get_weather]), # SDK сам строит схему из сигнатуры
)
def get_embeddings(texts: list[str],
task: str = "RETRIEVAL_DOCUMENT") -> list[list[float]]:
"""task: RETRIEVAL_DOCUMENT | RETRIEVAL_QUERY | SEMANTIC_SIMILARITY |
CLASSIFICATION | CLUSTERING"""
result = client.models.embed_content(
model="gemini-embedding-001",
contents=texts,
config=types.EmbedContentConfig(task_type=task),
)
return [e.values for e in result.embeddings]
Альтернатива (основной стек brain/RAG) — OpenAI text-embedding-3-large, см. config/models.md.
def tts(text: str, out_path: str, voice: str = "Kore"):
"""Голоса: Puck, Charon, Kore, Fenrir, Aoede и др."""
response = client.models.generate_content(
model="gemini-3.1-flash-tts-preview",
contents=text,
config=types.GenerateContentConfig(
response_modalities=["AUDIO"],
speech_config=types.SpeechConfig(
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name=voice))),
),
)
with open(out_path, "wb") as f: # PCM 24kHz — при необходимости завернуть в WAV
f.write(response.candidates[0].content.parts[0].inline_data.data)
Для продакшн-озвучки основной канон — ElevenLabs (skill elevenlabs) / tts-1-hd.
async def live_session(audio_bytes: bytes):
"""Realtime диалог: аудио на вход, аудио/текст на выход, tools внутри сессии.
Live-модель бери из discovery (live-эндпоинты дрейфуют чаще остальных)."""
config = {"response_modalities": ["AUDIO"]}
async with client.aio.live.connect(model=LIVE_MODEL, config=config) as session:
await session.send_realtime_input(
audio=types.Blob(data=audio_bytes, mime_type="audio/pcm;rate=16000"))
async for msg in session.receive():
if msg.data:
yield msg.data
Для батч-транскрипции используй Files API (transcribe_audio выше) или Deepgram/Whisper (skill deepgram).
Hermes/боты ходят в Gemini через OpenAI-совместимый эндпоинт:
base_url: https://generativelanguage.googleapis.com/v1beta/openai
model: gemini-3-flash-preview # bare name, без "models/"
404 → неправильный base_url или модели нет на ключе (прогони discovery). Детали, rate limits (free tier ~1500 req/day), пустой message {} при выжранном reasoning-бюджете — в autonomous-agent-creator/references/gemini-api-models.md.
Здесь НЕ реализуется. Канон-модели из config/models.md:
| Задача | Модель | Где |
|---|---|---|
| Картинки (default) | gemini-3.1-flash-image-preview (NB2) | skill image-generation |
| Картинки (обложки news) | gemini-3.1-flash-lite-image (NB2 Lite) | skill image-generation |
| Картинки (флагман) | gemini-3-pro-image-preview (NB Pro) | skill nano-banana-pro |
| Видео | veo-3.1-generate-preview — единственный оставшийся путь | skill video-generation |
Ключ для image — GOOGLE_API_KEY + os.environ.pop('GEMINI_API_KEY', None); модель отдаёт JPEG, не PNG.
| Модель | Input | Output |
|---|---|---|
| gemini-3-flash-preview | ~$0.10 | ~$0.40 |
| gemini-2.5-flash-lite | ~$0.04 | ~$0.20 |
| gemini-3.1-pro-preview | ~$1.25 | ~$10 |
Gemini Flash ~30× дешевле Sonnet на бот-нагрузках. Актуализация — в reference-файле.
| Задача | Код |
|---|---|
| Текст | client.models.generate_content(model=..., contents=prompt) |
| Стриминг | client.models.generate_content_stream(...) |
| Чат | client.chats.create(model=...) → chat.send_message(...) |
| Картинка/видео/PDF на вход | client.files.upload(file=path) → в contents |
| JSON по схеме | response_mime_type="application/json" + response_schema |
| Grounding | tools=[types.Tool(google_search=types.GoogleSearch())] |
| Code exec | tools=[types.Tool(code_execution=types.ToolCodeExecution())] |
| Embeddings | client.models.embed_content(model="gemini-embedding-001", ...) |
| Live | client.aio.live.connect(model=..., config=...) |
gemini-3-flash уже один раз молча умер в 404.gemini-3.1-pro-preview) — целые кодбазы/книги одним запросом.gemini-3-flash-preview primary, gemini-2.5-flash known-good fallback.from google import genai.image-generation / video-generation, канон config/models.md.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
gemini-api, google-ai, text-generation, embeddings, tts, multimodal
6 skills in this plugin
/deepseekDeepSeek API (deepseek-chat): кодогенерация, reasoning, 128K контекст. Триггеры: «дипсик», «спроси deepseek», «дешёвая кодогенерация»./jevJev (TypeSafe): решения вместо LLM — да/нет, выбор из N, шкала за 0,3 с. Триггеры: «классифицируй», «отранжируй», «проверь перед публикацией», «jev». НЕ генерация текста./kimiKimi у Moonshot (KIMI_API_KEY, модель kimi-k3): глубокий reasoning, код-анализ, алгоритмы. Триггеры: «спроси кими», «Kimi K2», «Kimi K3».npx claudepluginhub jhamidun/claude-code-config-pack --plugin ai-gatewaysOther plugins' skills for the same job