vertex-media-generation
БесплатноБез исполняемых скриптовНе проверенGenerates images with Gemini image models and videos with Veo through the Vercel AI SDK Google Vertex provider. Use when the user wants to generate or edit…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Vertex Media Generation
Overview
Build image and video generation features using Google Vertex AI through the Vercel AI SDK. Covers Gemini image models for image generation and mask-free editing (Google discontinued the Imagen endpoints on Vertex AI) and Veo 3.1 for video generation with optional audio. Uses the @ai-sdk/google-vertex provider with the unified ai SDK.
Instructions
Step 1: Set up the project
npm install ai @ai-sdk/google-vertex
gcloud auth application-default login
Use the default provider instance (reads GOOGLE_CLOUD_PROJECT from env), or create a custom one:
import { vertex } from '@ai-sdk/google-vertex';
// Or: import { createVertex } from '@ai-sdk/google-vertex';
// const vertex = createVertex({ project: 'my-gcp-project', location: 'us-central1' });
Step 2: Generate images with Gemini image models
Google has discontinued the Imagen endpoints on Vertex AI (imagen-3.0-generate-002, imagen-3.0-capability-001, imagen-4.0-generate-001, -fast- and -ultra-). Google's replacement mapping points all of them to gemini-2.5-flash-image, and the AI SDK Vertex page now documents only Gemini image models. Use generateImage with one of these:
import { vertex } from '@ai-sdk/google-vertex';
import { generateImage } from 'ai';
const { image } = await generateImage({
model: vertex.image('gemini-2.5-flash-image'),
prompt: 'A futuristic cityscape at sunset',
aspectRatio: '16:9',
});
| Model | Notes |
|---|---|
gemini-2.5-flash-image |
Stable default, the documented replacement for Imagen |
gemini-3-pro-image-preview |
Preview; up to 14 reference images |
gemini-3.1-flash-image-preview |
Preview |
Gemini image models do not support size or n; use aspectRatio (1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9). Preview model ids change often, so check the AI SDK Vertex page before pinning one.
Provider options go under providerOptions.vertex (type GoogleVertexImageModelOptions):
const { image } = await generateImage({
model: vertex.image('gemini-3-pro-image-preview'),
prompt: 'Professional headshot portrait',
providerOptions: {
vertex: {
imageConfig: {
aspectRatio: '1:1',
imageSize: '2K',
personGeneration: 'allow_adult',
},
},
},
});
Documented imageConfig keys: aspectRatio, imageSize (1K, 2K, 4K), personGeneration, prominentPeople, imageOutputOptions (mimeType, compressionQuality).
Step 3: Edit images
Gemini editing is mask-free: pass the source image(s) with an instruction. Inputs may be Buffer, ArrayBuffer, Uint8Array or base64 strings; URLs and gs:// paths are not supported, and mask-based inpainting is not supported by the AI SDK Gemini image path.
import fs from 'fs';
const { image } = await generateImage({
model: vertex.image('gemini-2.5-flash-image'),
prompt: {
text: 'Add a golden retriever sitting on the grass on the left',
images: [fs.readFileSync('./photo.png')],
},
});
fs.writeFileSync('photo-edited.png', Buffer.from(image.base64, 'base64'));
Describe what to keep and what to change ("keep the mug unchanged, replace the background with a beach"). The old Imagen edit modes (EDIT_MODE_INPAINT_INSERTION, EDIT_MODE_BGSWAP, maskMode) belong to the discontinued Imagen capability model.
Step 4: Generate videos with Veo
Use experimental_generateVideo for video generation. Video generation is asynchronous and may take several minutes:
import { vertex } from '@ai-sdk/google-vertex';
import { experimental_generateVideo as generateVideo } from 'ai';
const { video } = await generateVideo({
model: vertex.video('veo-3.1-generate-001'),
prompt: 'Aerial drone shot of a coral reef with tropical fish',
aspectRatio: '16:9',
resolution: '1920x1080',
duration: 8,
});
Available Veo models:
| Model | Notes |
|---|---|
veo-3.1-generate-001 |
Audio; 720p/1080p (4K output); 4, 6 or 8 s; 16:9 or 9:16 |
veo-3.1-fast-generate-001 |
Audio; faster, up to 1080p |
veo-3.1-lite-generate-001 |
Preview |
veo-3.0-generate-001 and veo-3.0-fast-generate-001 were retired on June 30, 2026; Google's replacements are the matching 3.1 ids. veo-2.0-generate-001 is listed in the AI SDK docs but absent from Google's current Veo pages, so prefer 3.1. Veo 3.1 supports frameImages (first_frame / last_frame) for image-to-video.
Configure with provider options:
const { video } = await generateVideo({
model: vertex.video('veo-3.1-generate-001'),
prompt: 'Time-lapse of a flower blooming',
aspectRatio: '16:9',
providerOptions: {
vertex: {
generateAudio: true,
personGeneration: 'allow_adult',
negativePrompt: 'blurry, shaky, low-resolution',
pollIntervalMs: 5000,
pollTimeoutMs: 600000,
},
},
});
Provider options: `gen
Установить vertex-media-generation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл vertex-media-generation?
Generates images with Gemini image models and videos with Veo through the Vercel AI SDK Google Vertex provider. Use when the user wants to generate or edit images, generate videos, migrate off discontinued Imagen models, or build media pipelines with @ai-sdk/google-vertex. Covers Gemini image models and Veo 3.1.
Как установить скилл vertex-media-generation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vertex-media-generation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic