Skip to content

50+ open-source generative AI apps you can clone, deploy, and monetize — image generators, video tools, virtual try-ons, AI SaaS templates, and platform integrations. One-click Vercel deploy on every template.

feat: add Python wrapper, MCP server, and updated API docs

Anil Matcha32a5695f697f
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..64921d6
--- /dev/null
+++ b/.env.example
@@ -0,0 +1 @@
+MUAPI_API_KEY=your_muapi_api_key_here
diff --git a/README.md b/README.md
index e0509d7..87e9480 100644
--- a/README.md
+++ b/README.md
@@ -1,32 +1,29 @@
# Awesome Gemini Omni Prompts
[![Awesome](https://awesome.re/badge.svg)](https://awesome.re)
+[![PyPI version](https://img.shields.io/pypi/v/gemini-omni-api.svg)](https://pypi.org/project/gemini-omni-api/)
[![Stars](https://img.shields.io/github/stars/Anil-matcha/Awesome-Gemini-Omni-API-Prompts?style=flat-square)](https://github.com/Anil-matcha/Awesome-Gemini-Omni-API-Prompts/stargazers)
[![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](LICENSE)
-A curated collection of high-quality prompts and patterns for **Gemini Omni** — Google's native multimodal video model announced at Google I/O 2026. This repository is your go-to reference for prompting Gemini Omni across text-to-video, image-to-video, audio-to-lip-sync, and conversational video editing — covering cinematic shots, character-consistent stories, product ads, anime, scientific visualization, B-roll, and more.
+A curated collection of high-quality prompts and patterns for **Gemini Omni** — a natively multimodal any-to-any video model. This repository is your go-to reference for prompting Gemini Omni across text-to-video, image-to-video, audio-to-lip-sync, and video editing — covering cinematic shots, character-consistent stories, product ads, anime, scientific visualization, B-roll, and more.
-Whether you're building a video generation app, exploring the Gemini API, or chasing cleaner prompt patterns, you'll find ready-to-use prompts here that unlock Gemini Omni's full potential.
+Whether you're building a video generation app or chasing cleaner prompt patterns, you'll find ready-to-use prompts here that unlock Gemini Omni's full potential.
Join the discussion: https://www.reddit.com/r/GeminiOmniAI/
-> **Want to use Gemini Omni without a Google account?** Try **[MuAPI](https://muapi.ai/gemini-omni)** — a hosted media API that gives you Gemini Omni text-to-video, image-to-video, and reference-based remixing with a simple REST call. [Get your API key →](https://muapi.ai)
-
-> **API Usage:** All prompts are designed for the [Gemini API](https://ai.google.dev/gemini-api/docs) using model `gemini-omni` (or `gemini-omni-flash` for faster, cheaper generations).
+> **API access:** All prompts work with **[MuAPI](https://muapi.ai/gemini-omni)** — a hosted media API that gives you Gemini Omni text-to-video, image-to-video, and video-edit with a simple REST call. [Get your API key →](https://muapi.ai)
```python
-from google import genai
+from gemini_omni_api import GeminiOmniAPI
-client = genai.Client()
-operation = client.models.generate_videos(
- model="gemini-omni",
+api = GeminiOmniAPI(api_key="your-muapi-key")
+job = api.text_to_video(
prompt="<paste any prompt from this list>",
- config={"aspect_ratio": "16:9", "duration_seconds": 8, "resolution": "1080p"},
+ duration=8,
+ aspect_ratio="16:9",
)
-while not operation.done:
- operation = client.operations.get(operation)
-video = operation.response.generated_videos[0]
-video.video.save("output.mp4")
+result = api.wait_for_completion(job["request_id"])
+print(result["outputs"])
```
---
@@ -57,6 +54,7 @@ Gemini Omni is a leap beyond specialized video models because it is a true omni-
- [Conversational Edits & Remixes](#conversational-edits--remixes)
- [Audio-Driven & Lip-Sync](#audio-driven--lip-sync)
- [Resources & API Docs](#resources--api-docs)
+- [Use Gemini Omni via MuAPI](#use-gemini-omni-via-muapi)
- [Contributing](#contributing)
---
@@ -502,55 +500,13 @@ Use the attached character. Generate a perfectly looped 4-second dance clip sync
## Resources & API Docs
-### Official References
-- [Gemini API Documentation](https://ai.google.dev/gemini-api/docs)
-- [Google AI Studio](https://aistudio.google.com)
-- [Vertex AI — Generative Media](https://cloud.google.com/vertex-ai/generative-ai/docs)
-- [Gemini API Pricing](https://ai.google.dev/gemini-api/docs/pricing)
-
-### API Quick Reference
-
-```python
-from google import genai
-
-client = genai.Client()
-
-# Text-to-video
-operation = client.models.generate_videos(
- model="gemini-omni",
- prompt="your prompt here",
- config={
- "aspect_ratio": "16:9", # 16:9, 9:16, 1:1, 21:9, 4:3
- "duration_seconds": 8, # 4–15s standard
- "resolution": "1080p", # 720p, 1080p, 4k
- "fps": 24, # 24 or 30
- "negative_prompt": "blurry, low quality, watermark",
- },
-)
-
-# Image-to-video (reference)
-operation = client.models.generate_videos(
- model="gemini-omni",
- prompt="animate the subject walking forward into the rain",
- image="reference.png",
- config={"aspect_ratio": "9:16", "duration_seconds": 6},
-)
-
-# Conversational edit (follow-up on prior generation)
-operation = client.models.edit_video(
- model="gemini-omni",
- source_video_id=prev_video.id,
- prompt="make it golden hour and slow down the last 2 seconds",
-)
-```
-
### Prompt Engineering Tips
1. **Lead with cinematography vocabulary** — Specify lens (35mm, anamorphic, macro), camera move (dolly-in, crane, Steadicam, locked-off), and lighting (golden hour, volumetric, hard rim).
2. **Structure as Subject → Motion → Camera → Mood** — Keep each layer explicit; Gemini Omni follows multi-clause prompts reliably.
3. **Anchor identity with reference images** — For any character or product, attach a reference and write *"use the attached image as the subject, preserve face/label/colorway exactly."*
4. **Use explicit durations and timestamps** — `0–4s wide shot, 4–8s push-in, 8–12s close-up` gives Omni a cut list to follow.
-5. **Specify aspect ratio in-prompt as a backup** — Even if you set it in config, mention `9:16 vertical` or `21:9 cinemascope` in the text.
+5. **Specify aspect ratio in-prompt as a backup** — Even if you set it in the API, mention `9:16 vertical` in the text too.
6. **Negative cues work** — Add `no captions, no watermark, no morphing` to suppress common artifacts.
7. **For consistency across scenes** — Repeat the identity descriptor in each scene block ("same woman in the same red coat") rather than relying on coreference.
8. **For edits, isolate what's changing** — *"Keep everything identical except…"* outperforms re-describing the whole scene.
@@ -559,58 +515,187 @@ operation = client.models.edit_video(
## Use Gemini Omni via MuAPI
-[MuAPI](https://muapi.ai) provides Gemini Omni as a hosted API — no Google account or Cloud project required. Supports text-to-video, image-to-video, and audio-driven generation.
+[MuAPI](https://muapi.ai) provides Gemini Omni as a hosted REST API — no extra account required.
+
+### Installation
+
+```bash
+pip install gemini-omni-api
+```
+
+Or clone this repo and install directly:
+
+```bash
+git clone https://github.com/Anil-matcha/Awesome-Gemini-Omni-API-Prompts.git
+cd Awesome-Gemini-Omni-API-Prompts
+pip install -r requirements.txt
+cp .env.example .env # add your MUAPI_API_KEY
+```
+
+### Python Wrapper — Quick Start
+
+```python
+from gemini_omni_api import GeminiOmniAPI
+
+api = GeminiOmniAPI(api_key="your-muapi-key") # or set MUAPI_API_KEY env var
+
+# ── Text-to-video ────────────────────────────────────────────────────────────
+job = api.text_to_video(
+ prompt="Golden hour drone shot over Big Sur cliffs revealing a lone surfer on glassy water",
+ duration=8, # 4 | 6 | 8 | 10
+ aspect_ratio="16:9", # "16:9" | "9:16"
+ audio_id="aoede", # optional — one of 30 named voices
+ seed=42, # optional — for reproducibility
+)
+result = api.wait_for_completion(job["request_id"])
+print(result["outputs"])
+
+# ── Image-to-video ───────────────────────────────────────────────────────────
+image_url = api.upload_file("reference.png") # upload local file → public URL
+
+job = api.image_to_video(
+ prompt="Animate the subject walking forward with subtle natural motion",
+ image_urls=[image_url], # list of 1–7 image URLs (each ≤20 MB)
+ duration=6,
+ aspect_ratio="9:16",
+)
+result = api.wait_for_completion(job["request_id"])
+
+# ── Video edit ───────────────────────────────────────────────────────────────
+video_url = api.upload_file("source_clip.mp4")
+
+job = api.video_edit(
+ prompt="Restyle the entire clip as a hand-drawn Studio Ghibli animation",
+ video_url=video_url,
+ trim_start=0,
+ trim_end=8, # max 10 s window
+ duration=8,
+ aspect_ratio="16:9",
+)
+result = api.wait_for_completion(job["request_id"])
+
+# ── Video edit with images + video ───────────────────────────────────────────
+# When video_url is set, up to 5 image_urls are allowed (video uses 2 of 7 slots)
+job = api.video_edit(
+ prompt="Add bioluminescent fireflies reacting to the leaves in the scene",
+ video_url=video_url,
+ image_urls=[image_url], # up to 5 when video is also provided
+ duration=8,
+)
+```
+
+### REST API Reference
+
+All endpoints follow the same submit → poll pattern:
+
+```
+POST https://api.muapi.ai/api/v1/{endpoint} → {"request_id": "abc123", "status": "processing"}
+GET https://api.muapi.ai/api/v1/predictions/{request_id}/result → poll until status == "completed"
+```
-### Text-to-Video
+#### Text-to-Video
```python
-import httpx, time
+import requests, time
API_KEY = "your-muapi-key"
BASE = "https://api.muapi.ai/api/v1"
-# Submit
-resp = httpx.post(
+resp = requests.post(
f"{BASE}/gemini-omni-text-to-video",
headers={"x-api-key": API_KEY},
json={
- "prompt": "Golden hour drone shot over Big Sur cliffs revealing a lone surfer paddling on glassy water",
- "aspect_ratio": "16:9",
- "duration": 8,
+ "prompt": "35mm anamorphic rain-soaked Tokyo alley at 2 AM, slow dolly-in",
+ "duration": 8, # 4 | 6 | 8 | 10
+ "aspect_ratio": "16:9", # "16:9" | "9:16"
+ # "audio_ids": "aoede", # optional voice
+ # "seed": 42, # optional seed
},
)
request_id = resp.json()["request_id"]
-# Poll
while True:
- result = httpx.get(f"{BASE}/predictions/{request_id}/result", headers={"x-api-key": API_KEY}).json()
- if result["status"] == "completed":
- print(result["outputs"])
+ r = requests.get(f"{BASE}/predictions/{request_id}/result", headers={"x-api-key": API_KEY}).json()
+ if r["status"] == "completed":
+ print(r["outputs"])
break
time.sleep(5)
```
-### Image-to-Video
+#### Image-to-Video
```python
-# Upload your reference image first
-with open("character.png", "rb") as f:
- upload = httpx.post(f"{BASE}/upload_file", headers={"x-api-key": API_KEY}, files={"file": f})
-image_url = upload.json()["url"]
+# Upload reference image(s) first
+with open("reference.png", "rb") as f:
+ image_url = requests.post(
+ f"{BASE}/upload_file", headers={"x-api-key": API_KEY}, files={"file": f}
+ ).json()["url"]
-# Submit
-resp = httpx.post(
+resp = requests.post(
f"{BASE}/gemini-omni-image-to-video",
headers={"x-api-key": API_KEY},
json={
- "prompt": "Animate the subject walking forward with subtle natural motion, 9:16",
- "image_url": image_url,
+ "prompt": "Animate the subject with subtle breathing and gentle hair movement",
+ "image_urls": [image_url], # list of 1–7 URLs
"duration": 6,
+ "aspect_ratio": "9:16",
},
)
-request_id = resp.json()["request_id"]
```
+#### Video Edit
+
+```python
+with open("clip.mp4", "rb") as f:
+ video_url = requests.post(
+ f"{BASE}/upload_file", headers={"x-api-key": API_KEY}, files={"file": f}
+ ).json()["url"]
+
+resp = requests.post(
+ f"{BASE}/gemini-omni-video-edit",
+ headers={"x-api-key": API_KEY},
+ json={
+ "prompt": "Change the season to winter, add falling snow",
+ "video_url": video_url,
+ "trim_start": 0,
+ "trim_end": 8, # max 10 s window; source video max 30 s
+ "duration": 8,
+ "aspect_ratio": "16:9",
+ # "image_urls": [...], # optional reference images (max 5 when video is set)
+ },
+)
+```
+
+### API Parameters
+
+| Parameter | T2V | I2V | V2V | Values |
+|-----------|:---:|:---:|:---:|--------|
+| `prompt` | ✓ | ✓ | ✓ | string (required) |
+| `duration` | ✓ | ✓ | ✓ | `4` \| `6` \| `8` \| `10` (default `8`) |
+| `aspect_ratio` | ✓ | ✓ | ✓ | `"16:9"` \| `"9:16"` (default `"16:9"`) |
+| `audio_ids` | ✓ | ✓ | ✓ | one of 30 voice names (optional) |
+| `seed` | ✓ | ✓ | ✓ | int 0–2147483647 (optional) |
+| `image_urls` | — | ✓ | opt | list of 1–7 URLs, each ≤20 MB |
+| `video_url` | — | — | opt | URL, max 100 MB / 30 s |
+| `trim_start` | — | — | ✓ | float seconds (default `0`) |
+| `trim_end` | — | — | ✓ | float seconds, max 10 s window (default `10`) |
+
+**Image slot budget (V2V):** 7 slots total — video uses 2, each `audio_ids` voice uses 1.
+So with a video: max 5 `image_urls`.
+
+**Available `audio_ids` voices:**
+`achernar` · `achird` · `algenib` · `algieba` · `alnilam` · `aoede` · `autonoe` · `callirrhoe` · `charon` · `despina` · `enceladus` · `erinome` · `fenrir` · `gacrux` · `iapetus` · `kore` · `laomedeia` · `leda` · `orus` · `puck` · `pulcherrima` · `rasalgethi` · `sadachbia` · `sadaltager` · `schedar` · `sulafat` · `umbriel` · `vindemiatrix` · `zephyr` · `zubenelgenubi`
+
+### MCP Server
+
+Run Gemini Omni as an MCP tool server for AI agent frameworks:
+
+```bash
+python mcp_server.py
+```
+
+Tools exposed: `text_to_video`, `image_to_video`, `video_edit`, `upload_file`, `get_task_status`, `wait_for_completion`.
+
Get your API key at [muapi.ai](https://muapi.ai).
---
@@ -638,4 +723,4 @@ Contributions are welcome! Submit a Pull Request to add your best Gemini Omni pr
This project is licensed under the Creative Commons Attribution 4.0 International License — see the [LICENSE](LICENSE) file for details.
-*Community-maintained. Not affiliated with Google or DeepMind.*
+*Community-maintained.*
diff --git a/gemini_omni_api.py b/gemini_omni_api.py
new file mode 100644
index 0000000..43f3a02
--- /dev/null
+++ b/gemini_omni_api.py
@@ -0,0 +1,255 @@
+"""
+Gemini Omni API — Python wrapper for muapi.ai
+Endpoints: text-to-video, image-to-video, video-edit
+"""
+
+import os
+import time
+import requests
+from dotenv import load_dotenv
+
+load_dotenv()
+
+AUDIO_IDS = [
+ "achernar", "achird", "algenib", "algieba", "alnilam", "aoede", "autonoe",
+ "callirrhoe", "charon", "despina", "enceladus", "erinome", "fenrir", "gacrux",
+ "iapetus", "kore", "laomedeia", "leda", "orus", "puck", "pulcherrima",
+ "rasalgethi", "sadachbia", "sadaltager", "schedar", "sulafat", "umbriel",
+ "vindemiatrix", "zephyr", "zubenelgenubi",
+]
+
+DURATIONS = (4, 6, 8, 10)
+ASPECT_RATIOS = ("16:9", "9:16")
+
+
+class GeminiOmniAPI:
+ """Python wrapper for the Gemini Omni API on muapi.ai."""
+
+ BASE_URL = "https://api.muapi.ai/api/v1"
+
+ def __init__(self, api_key: str = None):
+ self.api_key = api_key or os.getenv("MUAPI_API_KEY")
+ if not self.api_key:
+ raise ValueError("API key required — set MUAPI_API_KEY or pass api_key=")
+ self.session = requests.Session()
+ self.session.headers.update({"x-api-key": self.api_key})
+
+ # ------------------------------------------------------------------ #
+ # Core generation endpoints #
+ # ------------------------------------------------------------------ #
+
+ def text_to_video(
+ self,
+ prompt: str,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+ ) -> dict:
+ """Generate a video from a text prompt.
+
+ Args:
+ prompt: Description of the desired video.
+ duration: Output length in seconds — one of 4, 6, 8, 10.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID (see AUDIO_IDS for valid values).
+ seed: Optional random seed 0–2147483647 for reproducibility.
+
+ Returns:
+ {"request_id": "...", "status": "processing"}
+ """
+ self._validate_duration(duration)
+ self._validate_aspect_ratio(aspect_ratio)
+ payload = {"prompt": prompt, "duration": duration, "aspect_ratio": aspect_ratio}
+ if audio_id:
+ self._validate_audio_id(audio_id)
+ payload["audio_ids"] = audio_id
+ if seed is not None:
+ payload["seed"] = seed
+ return self._post("/gemini-omni-text-to-video", payload)
+
+ def image_to_video(
+ self,
+ prompt: str,
+ image_urls: list,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+ ) -> dict:
+ """Animate one or more reference images with a text prompt.
+
+ Args:
+ prompt: Description of the desired motion and scene.
+ image_urls: List of 1–7 publicly accessible image URLs (each ≤20 MB).
+ duration: Output length in seconds — one of 4, 6, 8, 10.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID.
+ seed: Optional random seed.
+
+ Returns:
+ {"request_id": "...", "status": "processing"}
+ """
+ if not isinstance(image_urls, list) or not (1 <= len(image_urls) <= 7):
+ raise ValueError("image_urls must be a list of 1–7 URLs")
+ self._validate_duration(duration)
+ self._validate_aspect_ratio(aspect_ratio)
+ payload = {
+ "prompt": prompt,
+ "image_urls": image_urls,
+ "duration": duration,
+ "aspect_ratio": aspect_ratio,
+ }
+ if audio_id:
+ self._validate_audio_id(audio_id)
+ payload["audio_ids"] = audio_id
+ if seed is not None:
+ payload["seed"] = seed
+ return self._post("/gemini-omni-image-to-video", payload)
+
+ def video_edit(
+ self,
+ prompt: str,
+ video_url: str = None,
+ image_urls: list = None,
+ trim_start: float = 0,
+ trim_end: float = 10,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+ ) -> dict:
+ """Edit or restyle a source video and/or reference images.
+
+ At least one of video_url or image_urls must be provided.
+ When both are provided, the video uses 2 of 7 available image slots,
+ so image_urls may contain at most 5 images.
+
+ Args:
+ prompt: Edit instruction (e.g. "restyle as Studio Ghibli animation").
+ video_url: Source video URL (max 100 MB, max 30 s).
+ image_urls: Optional reference images (1–7, or 1–5 if video_url set).
+ trim_start: Start of the clip window in seconds (default 0).
+ trim_end: End of the clip window in seconds (default 10, max trim_end–trim_start = 10).
+ duration: Output length in seconds — one of 4, 6, 8, 10.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID.
+ seed: Optional random seed.
+
+ Returns:
+ {"request_id": "...", "status": "processing"}
+ """
+ if not video_url and not image_urls:
+ raise ValueError("Provide at least one of video_url or image_urls")
+ if image_urls is not None:
+ max_images = 5 if video_url else 7
+ if not (1 <= len(image_urls) <= max_images):
+ raise ValueError(f"image_urls must have 1–{max_images} entries (video uses 2 of 7 slots)")
+ if trim_end - trim_start > 10:
+ raise ValueError("trim_end − trim_start must not exceed 10 seconds")
+ if trim_end <= trim_start:
+ raise ValueError("trim_end must be greater than trim_start")
+ self._validate_duration(duration)
+ self._validate_aspect_ratio(aspect_ratio)
+
+ payload = {
+ "prompt": prompt,
+ "trim_start": trim_start,
+ "trim_end": trim_end,
+ "duration": duration,
+ "aspect_ratio": aspect_ratio,
+ }
+ if video_url:
+ payload["video_url"] = video_url
+ if image_urls:
+ payload["image_urls"] = image_urls
+ if audio_id:
+ self._validate_audio_id(audio_id)
+ payload["audio_ids"] = audio_id
+ if seed is not None:
+ payload["seed"] = seed
+ return self._post("/gemini-omni-video-edit", payload)
+
+ # ------------------------------------------------------------------ #
+ # File upload & result polling #
+ # ------------------------------------------------------------------ #
+
+ def upload_file(self, file_path: str) -> str:
+ """Upload a local file and return its public URL.
+
+ Args:
+ file_path: Path to an image or video file.
+
+ Returns:
+ Public URL string.
+ """
+ with open(file_path, "rb") as f:
+ resp = self.session.post(f"{self.BASE_URL}/upload_file", files={"file": f})
+ resp.raise_for_status()
+ return resp.json()["url"]
+
+ def get_result(self, request_id: str) -> dict:
+ """Fetch the current status and outputs for a request.
+
+ Returns:
+ {"status": "...", "outputs": [...]} where status is one of
+ queued / pending / processing / completed / failed / cancelled.
+ """
+ resp = self.session.get(f"{self.BASE_URL}/predictions/{request_id}/result")
+ resp.raise_for_status()
+ return resp.json()
+
+ def wait_for_completion(
+ self,
+ request_id: str,
+ poll_interval: int = 5,
+ timeout: int = 600,
+ ) -> dict:
+ """Block until the request completes (or times out).
+
+ Args:
+ request_id: ID returned by a generation endpoint.
+ poll_interval: Seconds between polls (default 5).
+ timeout: Maximum wait in seconds (default 600).
+
+ Returns:
+ Final result dict with status "completed".
+
+ Raises:
+ TimeoutError: If the job does not complete within timeout seconds.
+ RuntimeError: If the job fails or is cancelled.
+ """
+ deadline = time.time() + timeout
+ while time.time() < deadline:
+ result = self.get_result(request_id)
+ status = result.get("status")
+ if status == "completed":
+ return result
+ if status in ("failed", "cancelled"):
+ raise RuntimeError(f"Job {request_id} ended with status: {status}")
+ time.sleep(poll_interval)
+ raise TimeoutError(f"Job {request_id} did not complete within {timeout}s")
+
+ # ------------------------------------------------------------------ #
+ # Internal helpers #
+ # ------------------------------------------------------------------ #
+
+ def _post(self, path: str, payload: dict) -> dict:
+ resp = self.session.post(f"{self.BASE_URL}{path}", json=payload)
+ resp.raise_for_status()
+ return resp.json()
+
+ @staticmethod
+ def _validate_duration(duration: int):
+ if duration not in DURATIONS:
+ raise ValueError(f"duration must be one of {DURATIONS}, got {duration}")
+
+ @staticmethod
+ def _validate_aspect_ratio(aspect_ratio: str):
+ if aspect_ratio not in ASPECT_RATIOS:
+ raise ValueError(f"aspect_ratio must be one of {ASPECT_RATIOS}, got {aspect_ratio!r}")
+
+ @staticmethod
+ def _validate_audio_id(audio_id: str):
+ if audio_id not in AUDIO_IDS:
+ raise ValueError(f"audio_id {audio_id!r} is not valid. See AUDIO_IDS for options.")
diff --git a/mcp_server.py b/mcp_server.py
new file mode 100644
index 0000000..85a060d
--- /dev/null
+++ b/mcp_server.py
@@ -0,0 +1,156 @@
+"""
+Gemini Omni MCP Server — exposes the Gemini Omni API as MCP tools.
+Run with: python mcp_server.py
+"""
+
+import json
+from mcp.server.fastmcp import FastMCP
+from gemini_omni_api import GeminiOmniAPI
+
+mcp = FastMCP("gemini-omni")
+api = GeminiOmniAPI()
+
+
+def text_to_video(
+ prompt: str,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+) -> str:
+ """Generate a video from a text prompt using Gemini Omni.
+
+ Args:
+ prompt: Description of the desired video content.
+ duration: Output length — one of 4, 6, 8, 10 seconds.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID for synchronized audio.
+ seed: Optional random seed (0–2147483647) for reproducibility.
+ """
+ result = api.text_to_video(
+ prompt=prompt,
+ duration=duration,
+ aspect_ratio=aspect_ratio,
+ audio_id=audio_id,
+ seed=seed,
+ )
+ return json.dumps(result)
+
+
+def image_to_video(
+ prompt: str,
+ image_urls: list,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+) -> str:
+ """Animate one or more reference images with a text prompt.
+
+ Args:
+ prompt: Description of the desired motion and scene.
+ image_urls: List of 1–7 publicly accessible image URLs (each ≤20 MB).
+ duration: Output length — one of 4, 6, 8, 10 seconds.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID.
+ seed: Optional random seed.
+ """
+ result = api.image_to_video(
+ prompt=prompt,
+ image_urls=image_urls,
+ duration=duration,
+ aspect_ratio=aspect_ratio,
+ audio_id=audio_id,
+ seed=seed,
+ )
+ return json.dumps(result)
+
+
+def video_edit(
+ prompt: str,
+ video_url: str = None,
+ image_urls: list = None,
+ trim_start: float = 0,
+ trim_end: float = 10,
+ duration: int = 8,
+ aspect_ratio: str = "16:9",
+ audio_id: str = None,
+ seed: int = None,
+) -> str:
+ """Edit or restyle a source video and/or reference images.
+
+ At least one of video_url or image_urls must be provided.
+
+ Args:
+ prompt: Edit instruction (e.g. "restyle as Studio Ghibli animation").
+ video_url: Source video URL (max 100 MB, max 30 s).
+ image_urls: Optional reference images (1–7, or 1–5 if video_url is set).
+ trim_start: Start of the clip window in seconds.
+ trim_end: End of the clip window in seconds (max 10 s window).
+ duration: Output length — one of 4, 6, 8, 10 seconds.
+ aspect_ratio: "16:9" or "9:16".
+ audio_id: Optional voice ID.
+ seed: Optional random seed.
+ """
+ result = api.video_edit(
+ prompt=prompt,
+ video_url=video_url,
+ image_urls=image_urls,
+ trim_start=trim_start,
+ trim_end=trim_end,
+ duration=duration,
+ aspect_ratio=aspect_ratio,
+ audio_id=audio_id,
+ seed=seed,
+ )
+ return json.dumps(result)
+
+
+def upload_file(file_path: str) -> str:
+ """Upload a local image or video file and return its public URL.
+
+ Args:
+ file_path: Absolute or relative path to the file.
+ """
+ url = api.upload_file(file_path)
+ return json.dumps({"url": url})
+
+
+def get_task_status(request_id: str) -> str:
+ """Get the current status and outputs for a generation request.
+
+ Args:
+ request_id: The request_id returned by a generation endpoint.
+ """
+ result = api.get_result(request_id)
+ return json.dumps(result)
+
+
+def wait_for_completion(
+ request_id: str,
+ poll_interval: int = 5,
+ timeout: int = 600,
+) -> str:
+ """Block until a generation request completes and return the final result.
+
+ Args:
+ request_id: The request_id returned by a generation endpoint.
+ poll_interval: Seconds between polls (default 5).
+ timeout: Maximum wait time in seconds (default 600).
+ """
+ result = api.wait_for_completion(
+ request_id=request_id,
+ poll_interval=poll_interval,
+ timeout=timeout,
+ )
+ return json.dumps(result)
+
+
+if __name__ == "__main__":
+ mcp.run()
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..c9c1458
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,15 @@
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "gemini-omni-api"
+version = "0.1.0"
+authors = [{ name = "Anil Matcha" }]
+description = "Python wrapper for the Gemini Omni API on muapi.ai — text-to-video, image-to-video, and video-edit."
+readme = "README.md"
+requires-python = ">=3.7"
+dependencies = ["requests", "python-dotenv", "mcp[cli]"]
+
+[tool.setuptools]
+py-modules = ["gemini_omni_api", "mcp_server"]
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..cfb1418
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+requests
+python-dotenv
+mcp[cli]
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..d4a46ec
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,18 @@
+from setuptools import setup
+
+setup(
+ name="gemini-omni-api",
+ version="0.1.0",
+ author="Anil Matcha",
+ description="Python wrapper for the Gemini Omni API on muapi.ai — text-to-video, image-to-video, and video-edit.",
+ long_description=open("README.md").read(),
+ long_description_content_type="text/markdown",
+ py_modules=["gemini_omni_api", "mcp_server"],
+ install_requires=["requests", "python-dotenv", "mcp[cli]"],
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ ],
+ python_requires=">=3.7",
+)