MCPcopy Create free account
hub / github.com/pollinations/pollinations / generateVideo

Function generateVideo

apps/chat/src/utils/api.js:542–566  ·  view source on GitHub ↗
(prompt, options = {})

Source from the content-addressed store, hash-verified

540};
541
542export const generateVideo = async (prompt, options = {}) => {
543 const {
544 model = "veo",
545 seed = Math.floor(Math.random() * 2147483647),
546 nologo = false,
547 nofeed = false,
548 } = options;
549
550 const params = new URLSearchParams({ model, seed, nologo, nofeed });
551 // Correct endpoint: /video/{prompt} (not /image/{prompt})
552 const url = `${BASE_URL}/video/${encodeURIComponent(prompt)}?${params}`;
553 const token = getApiToken();
554 const headers = token ? { Authorization: `Bearer ${token}` } : {};
555 const response = await fetch(url, { headers });
556 if (!response.ok) throw await parseApiError(response);
557
558 const blob = await response.blob();
559 return new Promise((resolve, reject) => {
560 const reader = new FileReader();
561 reader.onloadend = () =>
562 resolve({ url: reader.result, prompt, model, seed });
563 reader.onerror = reject;
564 reader.readAsDataURL(blob);
565 });
566};
567
568// Generate speech/audio — GET /audio/{text}?voice=...
569export const generateAudio = async (text, options = {}) => {

Callers 1

AppFunction · 0.90

Calls 4

getApiTokenFunction · 0.85
blobMethod · 0.80
parseApiErrorFunction · 0.70
fetchFunction · 0.50

Tested by

no test coverage detected