google-veo3-1-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +257 -0
- package/dist/cli/batch.d.ts +8 -0
- package/dist/cli/batch.d.ts.map +1 -0
- package/dist/cli/batch.js +289 -0
- package/dist/cli/batch.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +372 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/extend.d.ts +14 -0
- package/dist/tools/extend.d.ts.map +1 -0
- package/dist/tools/extend.js +153 -0
- package/dist/tools/extend.js.map +1 -0
- package/dist/tools/generate.d.ts +10 -0
- package/dist/tools/generate.d.ts.map +1 -0
- package/dist/tools/generate.js +210 -0
- package/dist/tools/generate.js.map +1 -0
- package/dist/tools/interpolate.d.ts +12 -0
- package/dist/tools/interpolate.d.ts.map +1 -0
- package/dist/tools/interpolate.js +170 -0
- package/dist/tools/interpolate.js.map +1 -0
- package/dist/types/batch.d.ts +121 -0
- package/dist/types/batch.d.ts.map +1 -0
- package/dist/types/batch.js +37 -0
- package/dist/types/batch.js.map +1 -0
- package/dist/types/tools.d.ts +154 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +134 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/batch-config.d.ts +26 -0
- package/dist/utils/batch-config.d.ts.map +1 -0
- package/dist/utils/batch-config.js +283 -0
- package/dist/utils/batch-config.js.map +1 -0
- package/dist/utils/batch-manager.d.ts +43 -0
- package/dist/utils/batch-manager.d.ts.map +1 -0
- package/dist/utils/batch-manager.js +310 -0
- package/dist/utils/batch-manager.js.map +1 -0
- package/dist/utils/debug.d.ts +16 -0
- package/dist/utils/debug.d.ts.map +1 -0
- package/dist/utils/debug.js +44 -0
- package/dist/utils/debug.js.map +1 -0
- package/dist/utils/path.d.ts +36 -0
- package/dist/utils/path.d.ts.map +1 -0
- package/dist/utils/path.js +97 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/video.d.ts +44 -0
- package/dist/utils/video.d.ts.map +1 -0
- package/dist/utils/video.js +261 -0
- package/dist/utils/video.js.map +1 -0
- package/docs/GOOGLE_VEO_3.1_API_SPECIFICATION.md +392 -0
- package/examples/batch-config.json +44 -0
- package/package.json +48 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Google Veo 3.1 MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Provides tools for video generation using Google's Veo 3.1 API:
|
|
6
|
+
* - generate_video: Text-to-Video and Image-to-Video with reference images
|
|
7
|
+
* - extend_video: Extend existing videos by 7 seconds
|
|
8
|
+
* - interpolate_frames: Generate video between first and last frames
|
|
9
|
+
* - get_video_status: Check status of video generation operations
|
|
10
|
+
*/
|
|
11
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
12
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
13
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
14
|
+
import { config } from 'dotenv';
|
|
15
|
+
import { generateVideo } from './tools/generate.js';
|
|
16
|
+
import { extendVideo } from './tools/extend.js';
|
|
17
|
+
import { interpolateFrames } from './tools/interpolate.js';
|
|
18
|
+
import { getOperationStatus, getApiKey } from './utils/video.js';
|
|
19
|
+
import { debugLog, errorLog, infoLog } from './utils/debug.js';
|
|
20
|
+
import { MODELS, RESOLUTIONS, ASPECT_RATIOS, DURATIONS, REFERENCE_TYPES, PERSON_GENERATION_OPTIONS } from './types/tools.js';
|
|
21
|
+
// Load environment variables
|
|
22
|
+
config();
|
|
23
|
+
// Verify API key is available
|
|
24
|
+
try {
|
|
25
|
+
getApiKey();
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
errorLog('GOOGLE_API_KEY not found in environment variables');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
// =============================================================================
|
|
32
|
+
// Tool Definitions
|
|
33
|
+
// =============================================================================
|
|
34
|
+
const tools = [
|
|
35
|
+
{
|
|
36
|
+
name: 'generate_video',
|
|
37
|
+
description: `Generate a video using Google Veo 3.1 API.
|
|
38
|
+
|
|
39
|
+
Supports:
|
|
40
|
+
- Text-to-Video: Generate video from a text prompt
|
|
41
|
+
- Image-to-Video: Animate a static image
|
|
42
|
+
- Reference Images: Use up to 3 asset images or 1 style image for consistency
|
|
43
|
+
|
|
44
|
+
Models:
|
|
45
|
+
- veo-3.1-generate-preview: High quality (default)
|
|
46
|
+
- veo-3.1-fast-generate-preview: Faster generation
|
|
47
|
+
|
|
48
|
+
Pricing (per second):
|
|
49
|
+
- 720p/1080p with audio: $0.40 (standard) / $0.20 (fast)
|
|
50
|
+
- 720p/1080p video only: $0.20 (standard) / $0.10 (fast)
|
|
51
|
+
- 4K with audio: $0.60 (standard only)`,
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
prompt: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'Text prompt describing the video to generate. Required unless image is provided.'
|
|
58
|
+
},
|
|
59
|
+
model: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
enum: MODELS,
|
|
62
|
+
description: 'Model to use for generation. Default: veo-3.1-generate-preview'
|
|
63
|
+
},
|
|
64
|
+
aspect_ratio: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
enum: ASPECT_RATIOS,
|
|
67
|
+
description: 'Aspect ratio of the video. Default: 16:9'
|
|
68
|
+
},
|
|
69
|
+
resolution: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
enum: RESOLUTIONS,
|
|
72
|
+
description: 'Video resolution. 4K only available for standard model. Default: 720p'
|
|
73
|
+
},
|
|
74
|
+
duration_seconds: {
|
|
75
|
+
type: 'number',
|
|
76
|
+
enum: DURATIONS,
|
|
77
|
+
description: 'Duration of the video in seconds (4, 6, or 8). Default: 8'
|
|
78
|
+
},
|
|
79
|
+
generate_audio: {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
description: 'Whether to generate audio. Note: Gemini API preview always generates audio (this parameter is ignored). Use Vertex AI for audio control.'
|
|
82
|
+
},
|
|
83
|
+
negative_prompt: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'Elements to avoid in the generated video'
|
|
86
|
+
},
|
|
87
|
+
image: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Image for Image-to-Video mode. Can be a file path, URL, or base64 string'
|
|
90
|
+
},
|
|
91
|
+
reference_images: {
|
|
92
|
+
type: 'array',
|
|
93
|
+
items: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
image: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'Image file path, URL, or base64 string'
|
|
99
|
+
},
|
|
100
|
+
reference_type: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
enum: REFERENCE_TYPES,
|
|
103
|
+
description: 'Type of reference: "asset" for characters/objects, "style" for visual style'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
required: ['image', 'reference_type']
|
|
107
|
+
},
|
|
108
|
+
description: 'Reference images for consistency. Max 3 asset images or 1 style image'
|
|
109
|
+
},
|
|
110
|
+
person_generation: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
enum: PERSON_GENERATION_OPTIONS,
|
|
113
|
+
description: 'Control person generation: allow_adult (default), dont_allow, allow_all'
|
|
114
|
+
},
|
|
115
|
+
seed: {
|
|
116
|
+
type: 'number',
|
|
117
|
+
description: 'Random seed for reproducibility (0-4294967295)'
|
|
118
|
+
},
|
|
119
|
+
output_path: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'Path to save the generated video. If not provided, uses OUTPUT_DIR env var'
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
required: []
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'extend_video',
|
|
129
|
+
description: `Extend an existing video by 7 seconds using Veo 3.1 API.
|
|
130
|
+
|
|
131
|
+
The extension continues from the last second of the input video.
|
|
132
|
+
|
|
133
|
+
Requirements:
|
|
134
|
+
- Input video: 1-30 seconds, 24fps, 720p or 1080p
|
|
135
|
+
- Output: Always 7 seconds at 720p
|
|
136
|
+
|
|
137
|
+
Estimated cost: ~$1.40 per extension`,
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: 'object',
|
|
140
|
+
properties: {
|
|
141
|
+
video: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
description: 'Video to extend. Can be a GCS URI (gs://), file path, URL, or base64 string'
|
|
144
|
+
},
|
|
145
|
+
prompt: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
description: 'Optional prompt to guide the extension'
|
|
148
|
+
},
|
|
149
|
+
output_path: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'Path to save the extended video'
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
required: ['video']
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'interpolate_frames',
|
|
159
|
+
description: `Generate a video that smoothly transitions between two keyframes using Veo 3.1 API.
|
|
160
|
+
|
|
161
|
+
Creates a video that starts at the first frame and ends at the last frame with AI-generated motion in between.
|
|
162
|
+
|
|
163
|
+
Pricing: Same as generate_video based on duration and audio settings`,
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: 'object',
|
|
166
|
+
properties: {
|
|
167
|
+
first_frame: {
|
|
168
|
+
type: 'string',
|
|
169
|
+
description: 'Starting frame image. Can be a file path, URL, or base64 string'
|
|
170
|
+
},
|
|
171
|
+
last_frame: {
|
|
172
|
+
type: 'string',
|
|
173
|
+
description: 'Ending frame image. Can be a file path, URL, or base64 string'
|
|
174
|
+
},
|
|
175
|
+
prompt: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
description: 'Optional prompt to guide the interpolation'
|
|
178
|
+
},
|
|
179
|
+
duration_seconds: {
|
|
180
|
+
type: 'number',
|
|
181
|
+
enum: DURATIONS,
|
|
182
|
+
description: 'Duration of the video in seconds (4, 6, or 8). Default: 8'
|
|
183
|
+
},
|
|
184
|
+
generate_audio: {
|
|
185
|
+
type: 'boolean',
|
|
186
|
+
description: 'Whether to generate audio. Note: Gemini API preview always generates audio (ignored).'
|
|
187
|
+
},
|
|
188
|
+
output_path: {
|
|
189
|
+
type: 'string',
|
|
190
|
+
description: 'Path to save the generated video'
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
required: ['first_frame', 'last_frame']
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'get_video_status',
|
|
198
|
+
description: `Check the status of a video generation operation.
|
|
199
|
+
|
|
200
|
+
Returns the current status (done/pending) and video URL if completed.`,
|
|
201
|
+
inputSchema: {
|
|
202
|
+
type: 'object',
|
|
203
|
+
properties: {
|
|
204
|
+
operation_name: {
|
|
205
|
+
type: 'string',
|
|
206
|
+
description: 'The operation name returned from generate_video, extend_video, or interpolate_frames'
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
required: ['operation_name']
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
];
|
|
213
|
+
// =============================================================================
|
|
214
|
+
// Server Setup
|
|
215
|
+
// =============================================================================
|
|
216
|
+
const server = new Server({
|
|
217
|
+
name: 'google-veo3-1-mcp-server',
|
|
218
|
+
version: '1.0.0'
|
|
219
|
+
}, {
|
|
220
|
+
capabilities: {
|
|
221
|
+
tools: {}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
// =============================================================================
|
|
225
|
+
// Request Handlers
|
|
226
|
+
// =============================================================================
|
|
227
|
+
// List available tools
|
|
228
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
229
|
+
debugLog('Listing tools');
|
|
230
|
+
return { tools };
|
|
231
|
+
});
|
|
232
|
+
// Handle tool calls
|
|
233
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
234
|
+
const { name, arguments: args } = request.params;
|
|
235
|
+
debugLog(`Tool called: ${name}`, args);
|
|
236
|
+
try {
|
|
237
|
+
switch (name) {
|
|
238
|
+
case 'generate_video': {
|
|
239
|
+
const params = args;
|
|
240
|
+
const result = await generateVideo(params);
|
|
241
|
+
return {
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: 'text',
|
|
245
|
+
text: JSON.stringify(result, null, 2)
|
|
246
|
+
}
|
|
247
|
+
]
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
case 'extend_video': {
|
|
251
|
+
const params = args;
|
|
252
|
+
const result = await extendVideo(params);
|
|
253
|
+
return {
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: 'text',
|
|
257
|
+
text: JSON.stringify(result, null, 2)
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
case 'interpolate_frames': {
|
|
263
|
+
const params = args;
|
|
264
|
+
const result = await interpolateFrames(params);
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: 'text',
|
|
269
|
+
text: JSON.stringify(result, null, 2)
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
case 'get_video_status': {
|
|
275
|
+
const params = args;
|
|
276
|
+
if (!params.operation_name) {
|
|
277
|
+
return {
|
|
278
|
+
content: [
|
|
279
|
+
{
|
|
280
|
+
type: 'text',
|
|
281
|
+
text: JSON.stringify({
|
|
282
|
+
success: false,
|
|
283
|
+
error: 'operation_name is required'
|
|
284
|
+
}, null, 2)
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
const apiKey = getApiKey();
|
|
291
|
+
const status = await getOperationStatus(params.operation_name, apiKey);
|
|
292
|
+
const result = {
|
|
293
|
+
success: true,
|
|
294
|
+
operation_name: params.operation_name,
|
|
295
|
+
done: status.done ?? false
|
|
296
|
+
};
|
|
297
|
+
if (status.done && status.response?.generatedVideos?.length) {
|
|
298
|
+
result.video_url = status.response.generatedVideos[0].video.uri;
|
|
299
|
+
}
|
|
300
|
+
if (status.error) {
|
|
301
|
+
result.success = false;
|
|
302
|
+
result.error = status.error.message;
|
|
303
|
+
result.failure_reason = `Error code: ${status.error.code}`;
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
content: [
|
|
307
|
+
{
|
|
308
|
+
type: 'text',
|
|
309
|
+
text: JSON.stringify(result, null, 2)
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
return {
|
|
316
|
+
content: [
|
|
317
|
+
{
|
|
318
|
+
type: 'text',
|
|
319
|
+
text: JSON.stringify({
|
|
320
|
+
success: false,
|
|
321
|
+
operation_name: params.operation_name,
|
|
322
|
+
done: false,
|
|
323
|
+
error: error instanceof Error ? error.message : String(error)
|
|
324
|
+
}, null, 2)
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
default:
|
|
331
|
+
return {
|
|
332
|
+
content: [
|
|
333
|
+
{
|
|
334
|
+
type: 'text',
|
|
335
|
+
text: JSON.stringify({
|
|
336
|
+
success: false,
|
|
337
|
+
error: `Unknown tool: ${name}`
|
|
338
|
+
}, null, 2)
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
errorLog(`Tool execution failed: ${name}`, error);
|
|
346
|
+
return {
|
|
347
|
+
content: [
|
|
348
|
+
{
|
|
349
|
+
type: 'text',
|
|
350
|
+
text: JSON.stringify({
|
|
351
|
+
success: false,
|
|
352
|
+
error: error instanceof Error ? error.message : String(error)
|
|
353
|
+
}, null, 2)
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
// =============================================================================
|
|
360
|
+
// Start Server
|
|
361
|
+
// =============================================================================
|
|
362
|
+
async function main() {
|
|
363
|
+
infoLog('Starting Google Veo 3.1 MCP Server...');
|
|
364
|
+
const transport = new StdioServerTransport();
|
|
365
|
+
await server.connect(transport);
|
|
366
|
+
infoLog('Server connected and ready');
|
|
367
|
+
}
|
|
368
|
+
main().catch((error) => {
|
|
369
|
+
errorLog('Server failed to start', error);
|
|
370
|
+
process.exit(1);
|
|
371
|
+
});
|
|
372
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,SAAS,EACT,eAAe,EACf,yBAAyB,EAM1B,MAAM,kBAAkB,CAAC;AAE1B,6BAA6B;AAC7B,MAAM,EAAE,CAAC;AAET,8BAA8B;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AC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACxC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,QAAQ,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Extension Tool for Veo 3.1
|
|
3
|
+
* Extends an existing video by 7 seconds
|
|
4
|
+
*/
|
|
5
|
+
import { type ExtendVideoParams, type VideoGenerationResult } from '../types/tools.js';
|
|
6
|
+
/**
|
|
7
|
+
* Extend a video by 7 seconds using Veo 3.1 API
|
|
8
|
+
*
|
|
9
|
+
* Requirements:
|
|
10
|
+
* - Input video: 1-30 seconds, 24fps, 720p or 1080p
|
|
11
|
+
* - Output: 7 seconds extension at 720p
|
|
12
|
+
*/
|
|
13
|
+
export declare function extendVideo(params: ExtendVideoParams): Promise<VideoGenerationResult>;
|
|
14
|
+
//# sourceMappingURL=extend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../src/tools/extend.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQL,KAAK,iBAAiB,EAGtB,KAAK,qBAAqB,EAE3B,MAAM,mBAAmB,CAAC;AAW3B;;;;;;GAMG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqK3F"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Extension Tool for Veo 3.1
|
|
3
|
+
* Extends an existing video by 7 seconds
|
|
4
|
+
*/
|
|
5
|
+
import { GEMINI_API_BASE_URL, DEFAULT_MODEL, EXTENSION_DURATION, EXTENSION_RESOLUTION, DEFAULT_POLL_INTERVAL, DEFAULT_MAX_POLL_ATTEMPTS, calculateCost } from '../types/tools.js';
|
|
6
|
+
import { getApiKey, pollVideoResult, downloadAndSaveVideo, extractVideoFromResponse, readVideoAsBase64 } from '../utils/video.js';
|
|
7
|
+
import { generateDefaultOutputPath, getDisplayPath } from '../utils/path.js';
|
|
8
|
+
import { debugLog, errorLog } from '../utils/debug.js';
|
|
9
|
+
/**
|
|
10
|
+
* Extend a video by 7 seconds using Veo 3.1 API
|
|
11
|
+
*
|
|
12
|
+
* Requirements:
|
|
13
|
+
* - Input video: 1-30 seconds, 24fps, 720p or 1080p
|
|
14
|
+
* - Output: 7 seconds extension at 720p
|
|
15
|
+
*/
|
|
16
|
+
export async function extendVideo(params) {
|
|
17
|
+
const apiKey = getApiKey();
|
|
18
|
+
// Validate required parameter
|
|
19
|
+
if (!params.video) {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
error: 'Video parameter is required for video extension'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const model = DEFAULT_MODEL;
|
|
26
|
+
debugLog('Extending video with parameters', {
|
|
27
|
+
model,
|
|
28
|
+
hasPrompt: !!params.prompt,
|
|
29
|
+
videoSource: params.video.startsWith('gs://') ? 'GCS' : 'file/base64'
|
|
30
|
+
});
|
|
31
|
+
try {
|
|
32
|
+
// Build request instance
|
|
33
|
+
const instance = {};
|
|
34
|
+
if (params.prompt) {
|
|
35
|
+
instance.prompt = params.prompt;
|
|
36
|
+
}
|
|
37
|
+
// Handle video input
|
|
38
|
+
if (params.video.startsWith('gs://')) {
|
|
39
|
+
instance.video = { uri: params.video };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const base64Data = await readVideoAsBase64(params.video);
|
|
43
|
+
instance.video = { bytesBase64Encoded: base64Data };
|
|
44
|
+
}
|
|
45
|
+
// Build request - extension has fixed parameters
|
|
46
|
+
const request = {
|
|
47
|
+
instances: [instance],
|
|
48
|
+
parameters: {
|
|
49
|
+
// Extension is always 7 seconds at 720p
|
|
50
|
+
// These may be ignored by the API but we include them for completeness
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
debugLog('API Request', request);
|
|
54
|
+
// Make API call
|
|
55
|
+
const url = `${GEMINI_API_BASE_URL}/models/${model}:predictLongRunning?key=${apiKey}`;
|
|
56
|
+
const response = await fetch(url, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
'Content-Type': 'application/json'
|
|
60
|
+
},
|
|
61
|
+
body: JSON.stringify(request)
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const errorText = await response.text();
|
|
65
|
+
errorLog('API request failed', { status: response.status, error: errorText });
|
|
66
|
+
if (response.status === 401) {
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
error: 'Authentication failed. Please check your GOOGLE_API_KEY.'
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (response.status === 403) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: 'Access denied. Your API key may not have access to Veo 3.1.'
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (response.status === 429) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: 'Rate limit exceeded. Please try again later.'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (response.status === 400) {
|
|
85
|
+
return {
|
|
86
|
+
success: false,
|
|
87
|
+
error: `Invalid video for extension. Requirements: 1-30 seconds, 24fps, 720p or 1080p. Details: ${errorText}`
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
success: false,
|
|
92
|
+
error: `API request failed: ${response.status} ${response.statusText} - ${errorText}`
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const operationResponse = await response.json();
|
|
96
|
+
debugLog('Initial operation response', operationResponse);
|
|
97
|
+
const operationName = operationResponse.name;
|
|
98
|
+
// Calculate estimated cost (7 seconds at 720p, no audio for extensions)
|
|
99
|
+
const estimatedCost = calculateCost(model, EXTENSION_RESOLUTION, EXTENSION_DURATION, false);
|
|
100
|
+
// Poll for completion
|
|
101
|
+
const pollInterval = parseInt(process.env.VIDEO_POLL_INTERVAL || '') || DEFAULT_POLL_INTERVAL;
|
|
102
|
+
const maxAttempts = parseInt(process.env.VIDEO_MAX_POLL_ATTEMPTS || '') || DEFAULT_MAX_POLL_ATTEMPTS;
|
|
103
|
+
const finalResponse = await pollVideoResult(operationName, apiKey, pollInterval, maxAttempts);
|
|
104
|
+
// Check for errors
|
|
105
|
+
if (finalResponse.error) {
|
|
106
|
+
return {
|
|
107
|
+
success: false,
|
|
108
|
+
operation_name: operationName,
|
|
109
|
+
error: finalResponse.error.message,
|
|
110
|
+
failure_reason: `Error code: ${finalResponse.error.code}`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
// Extract video data
|
|
114
|
+
const videoData = extractVideoFromResponse(finalResponse);
|
|
115
|
+
if (!videoData) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
operation_name: operationName,
|
|
119
|
+
error: 'No video was generated. The content may have been filtered by safety policies.',
|
|
120
|
+
estimated_cost: estimatedCost
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
// Download and save if output path specified
|
|
124
|
+
let videoPath;
|
|
125
|
+
let videoUrl = videoData.url;
|
|
126
|
+
if (params.output_path || process.env.OUTPUT_DIR) {
|
|
127
|
+
const outputPath = params.output_path || generateDefaultOutputPath(process.env.OUTPUT_DIR || './output', 'veo3_extended');
|
|
128
|
+
try {
|
|
129
|
+
videoPath = await downloadAndSaveVideo(videoData.url, videoData.base64, outputPath);
|
|
130
|
+
debugLog('Extended video saved', { path: videoPath });
|
|
131
|
+
}
|
|
132
|
+
catch (downloadError) {
|
|
133
|
+
errorLog('Failed to save extended video', downloadError);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
success: true,
|
|
138
|
+
operation_name: operationName,
|
|
139
|
+
video_url: videoUrl,
|
|
140
|
+
video_path: videoPath ? getDisplayPath(videoPath) : undefined,
|
|
141
|
+
duration_seconds: EXTENSION_DURATION,
|
|
142
|
+
estimated_cost: estimatedCost
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
errorLog('Video extension failed', error);
|
|
147
|
+
return {
|
|
148
|
+
success: false,
|
|
149
|
+
error: error instanceof Error ? error.message : String(error)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=extend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../src/tools/extend.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,aAAa,EAMd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAyB;IACzD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,8BAA8B;IAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,iDAAiD;SACzD,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAU,aAAa,CAAC;IAEnC,QAAQ,CAAC,iCAAiC,EAAE;QAC1C,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AAQ,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;YACxD,CAAC;YAAC,OAAO,aAAa,EAAE,CAAC;gBACvB,QAAQ,CAAC,+BAA+B,EAAE,aAAa,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,cAAc,EAAE,aAAa;YAC7B,SAAS,EAAE,QAAQ;YACnB,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7D,gBAAgB,EAAE,kBAAkB;YACpC,cAAc,EAAE,aAAa;SAC9B,CAAC;IAEJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video Generation Tool for Veo 3.1
|
|
3
|
+
* Supports Text-to-Video, Image-to-Video, and Reference Images
|
|
4
|
+
*/
|
|
5
|
+
import { type GenerateVideoParams, type VideoGenerationResult } from '../types/tools.js';
|
|
6
|
+
/**
|
|
7
|
+
* Generate a video using Veo 3.1 API
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateVideo(params: GenerateVideoParams): Promise<VideoGenerationResult>;
|
|
10
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/tools/generate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAcL,KAAK,mBAAmB,EAGxB,KAAK,qBAAqB,EAG3B,MAAM,mBAAmB,CAAC;AAW3B;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA2O/F"}
|