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(gemini-omni): add resolution, audio_ids list, character_ids, audio profile and character endpoints

Anil Matchacc8bbf839a9e
diff --git a/README.md b/README.md
index c22f75b..cedfb39 100644
--- a/README.md
+++ b/README.md
@@ -29,15 +29,18 @@ job = api.text_to_video(
prompt="<paste any T2V prompt from this list>",
duration=8,
aspect_ratio="16:9",
+ resolution="1080p",
+ audio_ids=["aoede"], # optional — list of up to 3 voice names
)
# ── Image-to-Video ────────────────────────────────────────────────────────────
image_url = api.upload_file("reference.png") # upload local file → public URL
job = api.image_to_video(
prompt="<paste any I2V prompt from this list>",
- image_urls=[image_url], # 1–7 reference images, each ≤20 MB
+ image_urls=[image_url], # 1–5 reference images, each ≤20 MB
duration=6,
aspect_ratio="9:16",
+ resolution="1080p",
)
# ── Video Edit (V2V) ──────────────────────────────────────────────────────────
@@ -49,6 +52,7 @@ job = api.video_edit(
trim_end=8, # max 10 s window; source clip max 30 s
duration=8,
aspect_ratio="16:9",
+ resolution="1080p",
)
result = api.wait_for_completion(job["request_id"])
@@ -630,8 +634,10 @@ Use the attached character. Generate a perfectly looped 4-second dance clip sync
| Mode | Endpoint | Key inputs |
|------|----------|------------|
| Text-to-Video | `POST /gemini-omni-text-to-video` | `prompt` |
-| Image-to-Video | `POST /gemini-omni-image-to-video` | `prompt`, `image_urls` (1–7) |
+| Image-to-Video | `POST /gemini-omni-image-to-video` | `prompt`, `image_urls` (1–5) |
| Video Edit | `POST /gemini-omni-video-edit` | `prompt`, `video_url` and/or `image_urls` |
+| Audio Profile | `POST /gemini-omni-audio` | `audio_id`, `name` |
+| Character | `POST /gemini-omni-character` | `images_list`, `descriptions` |
All modes return `{"request_id": "..."}`. Poll `GET /predictions/{request_id}/result` until `status == "completed"`.
@@ -660,10 +666,11 @@ 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
+ duration=8, # 4 | 6 | 8 | 10
+ aspect_ratio="16:9", # "16:9" | "9:16"
+ resolution="1080p", # "720p" | "1080p" | "4k"
+ audio_ids=["aoede"], # optional — list of up to 3 voice names
+ seed=42, # optional — for reproducibility
)
result = api.wait_for_completion(job["request_id"])
print(result["outputs"])
@@ -673,9 +680,10 @@ image_url = api.upload_file("reference.png") # upload local file → public UR
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)
+ image_urls=[image_url], # list of 1–5 image URLs (each ≤20 MB)
duration=6,
aspect_ratio="9:16",
+ resolution="1080p",
)
result = api.wait_for_completion(job["request_id"])
@@ -689,17 +697,58 @@ job = api.video_edit(
trim_end=8, # max 10 s window
duration=8,
aspect_ratio="16:9",
+ resolution="1080p",
)
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)
+# When video_url is set, up to 5 image_urls are allowed
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,
)
+result = api.wait_for_completion(job["request_id"])
+```
+
+### Audio Profile & Character
+
+Create reusable voice profiles and characters to reference in your video generations:
+
+```python
+# ── Create an audio profile ──────────────────────────────────────────────────
+job = api.create_audio_profile(
+ audio_id="aoede", # base voice from AUDIO_IDS
+ name="My Narrator Voice",
+ voice_description="Warm, calm storytelling tone with slight British inflection",
+ example_dialogue="Welcome to the story. Let's begin.",
+)
+profile = api.wait_for_completion(job["request_id"])
+profile_id = profile["outputs"][0] # use this ID in audio_ids
+
+# ── Create a character ───────────────────────────────────────────────────────
+char_image_url = api.upload_file("hero_portrait.png")
+
+job = api.create_character(
+ image_url=char_image_url,
+ descriptions="A confident young woman with short dark hair and a leather jacket",
+ character_name="Alex",
+ audio_ids=["aoede"], # optional voice association
+)
+character = api.wait_for_completion(job["request_id"])
+character_id = character["outputs"][0] # use this ID in character_ids
+
+# ── Use character + audio in a video generation ──────────────────────────────
+job = api.text_to_video(
+ prompt="Alex walks into a sunlit café and orders a coffee, looking around curiously",
+ duration=8,
+ resolution="1080p",
+ character_ids=[character_id],
+ audio_ids=["aoede"],
+)
+result = api.wait_for_completion(job["request_id"])
+print(result["outputs"])
```
### REST API Reference
@@ -724,10 +773,12 @@ resp = requests.post(
headers={"x-api-key": API_KEY},
json={
"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
+ "duration": 8, # 4 | 6 | 8 | 10
+ "aspect_ratio": "16:9", # "16:9" | "9:16"
+ "resolution": "1080p", # "720p" | "1080p" | "4k"
+ # "audio_ids": ["aoede"], # optional — list of up to 3 voices
+ # "character_ids": [...], # optional character IDs
+ # "seed": 42, # optional seed
},
)
request_id = resp.json()["request_id"]
@@ -754,9 +805,12 @@ resp = requests.post(
headers={"x-api-key": API_KEY},
json={
"prompt": "Animate the subject with subtle breathing and gentle hair movement",
- "image_urls": [image_url], # list of 1–7 URLs
+ "image_urls": [image_url], # list of 1–5 URLs
"duration": 6,
"aspect_ratio": "9:16",
+ "resolution": "1080p", # "720p" | "1080p" | "4k"
+ # "audio_ids": ["aoede"], # optional — list of up to 3 voices
+ # "character_ids": [...], # optional character IDs
},
)
```
@@ -776,14 +830,56 @@ resp = requests.post(
"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
+ "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)
+ "resolution": "1080p", # "720p" | "1080p" | "4k"
+ # "image_urls": [...], # optional reference images (max 5)
+ # "audio_ids": ["aoede"], # optional — list of up to 3 voices
+ # "character_ids": [...], # optional character IDs
},
)
```
+#### Audio Profile
+
+```python
+resp = requests.post(
+ f"{BASE}/gemini-omni-audio",
+ headers={"x-api-key": API_KEY},
+ json={
+ "audio_id": "aoede", # base voice from AUDIO_IDS
+ "name": "My Narrator Voice",
+ # "voice_description": "Warm storytelling tone", # optional
+ # "example_dialogue": "Welcome to the story.", # optional
+ },
+)
+request_id = resp.json()["request_id"]
+# poll until completed to retrieve the profile ID
+```
+
+#### Character
+
+```python
+with open("hero_portrait.png", "rb") as f:
+ char_image_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-character",
+ headers={"x-api-key": API_KEY},
+ json={
+ "images_list": [char_image_url],
+ "descriptions": "A confident young woman with short dark hair and a leather jacket",
+ # "character_name": "Alex", # optional
+ # "audio_ids": ["aoede"], # optional voice association
+ },
+)
+request_id = resp.json()["request_id"]
+# poll until completed to retrieve the character ID
+```
+
### API Parameters
| Parameter | T2V | I2V | V2V | Values |
@@ -791,15 +887,16 @@ resp = requests.post(
| `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) |
+| `resolution` | ✓ | ✓ | ✓ | `"720p"` \| `"1080p"` \| `"4k"` (default `"1080p"`) |
+| `audio_ids` | ✓ | ✓ | ✓ | list of up to 3 voice names (optional) |
+| `character_ids` | ✓ | ✓ | ✓ | list of character IDs (optional) |
| `seed` | ✓ | ✓ | ✓ | int 0–2147483647 (optional) |
-| `image_urls` | — | ✓ | opt | list of 1–7 URLs, each ≤20 MB |
+| `image_urls` | — | ✓ | opt | list of 1–5 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`.
+**Image slot budget (V2V):** when `video_url` is set, 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`
diff --git a/gemini_omni_api.py b/gemini_omni_api.py
index 43f3a02..16574ac 100644
--- a/gemini_omni_api.py
+++ b/gemini_omni_api.py
@@ -1,6 +1,6 @@
"""
Gemini Omni API — Python wrapper for muapi.ai
-Endpoints: text-to-video, image-to-video, video-edit
+Endpoints: text-to-video, image-to-video, video-edit, audio-profile, character
"""
import os
@@ -20,6 +20,7 @@ AUDIO_IDS = [
DURATIONS = (4, 6, 8, 10)
ASPECT_RATIOS = ("16:9", "9:16")
+RESOLUTIONS = ("720p", "1080p", "4k")
class GeminiOmniAPI:
@@ -43,7 +44,9 @@ class GeminiOmniAPI:
prompt: str,
duration: int = 8,
aspect_ratio: str = "16:9",
- audio_id: str = None,
+ resolution: str = "1080p",
+ audio_ids: list = None,
+ character_ids: list = None,
seed: int = None,
) -> dict:
"""Generate a video from a text prompt.
@@ -52,7 +55,9 @@ class GeminiOmniAPI:
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).
+ resolution: Output resolution — "720p", "1080p", or "4k" (default "1080p").
+ audio_ids: Optional list of up to 3 voice names (see AUDIO_IDS).
+ character_ids: Optional list of character IDs to use in the video.
seed: Optional random seed 0–2147483647 for reproducibility.
Returns:
@@ -60,10 +65,18 @@ class GeminiOmniAPI:
"""
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
+ self._validate_resolution(resolution)
+ payload = {
+ "prompt": prompt,
+ "duration": duration,
+ "aspect_ratio": aspect_ratio,
+ "resolution": resolution,
+ }
+ if audio_ids:
+ self._validate_audio_ids(audio_ids)
+ payload["audio_ids"] = audio_ids
+ if character_ids:
+ payload["character_ids"] = character_ids
if seed is not None:
payload["seed"] = seed
return self._post("/gemini-omni-text-to-video", payload)
@@ -74,35 +87,43 @@ class GeminiOmniAPI:
image_urls: list,
duration: int = 8,
aspect_ratio: str = "16:9",
- audio_id: str = None,
+ resolution: str = "1080p",
+ audio_ids: list = None,
+ character_ids: list = 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).
+ image_urls: List of 1–5 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.
+ resolution: Output resolution — "720p", "1080p", or "4k" (default "1080p").
+ audio_ids: Optional list of up to 3 voice names (see AUDIO_IDS).
+ character_ids: Optional list of character IDs to use in the video.
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")
+ if not isinstance(image_urls, list) or not (1 <= len(image_urls) <= 5):
+ raise ValueError("image_urls must be a list of 1–5 URLs")
self._validate_duration(duration)
self._validate_aspect_ratio(aspect_ratio)
+ self._validate_resolution(resolution)
payload = {
"prompt": prompt,
"image_urls": image_urls,
"duration": duration,
"aspect_ratio": aspect_ratio,
+ "resolution": resolution,
}
- if audio_id:
- self._validate_audio_id(audio_id)
- payload["audio_ids"] = audio_id
+ if audio_ids:
+ self._validate_audio_ids(audio_ids)
+ payload["audio_ids"] = audio_ids
+ if character_ids:
+ payload["character_ids"] = character_ids
if seed is not None:
payload["seed"] = seed
return self._post("/gemini-omni-image-to-video", payload)
@@ -116,7 +137,9 @@ class GeminiOmniAPI:
trim_end: float = 10,
duration: int = 8,
aspect_ratio: str = "16:9",
- audio_id: str = None,
+ resolution: str = "1080p",
+ audio_ids: list = None,
+ character_ids: list = None,
seed: int = None,
) -> dict:
"""Edit or restyle a source video and/or reference images.
@@ -128,12 +151,14 @@ class GeminiOmniAPI:
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).
+ image_urls: Optional reference images (1–5, 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.
+ resolution: Output resolution — "720p", "1080p", or "4k" (default "1080p").
+ audio_ids: Optional list of up to 3 voice names (see AUDIO_IDS).
+ character_ids: Optional list of character IDs to use in the video.
seed: Optional random seed.
Returns:
@@ -142,15 +167,16 @@ class GeminiOmniAPI:
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
+ max_images = 5 if video_url else 5
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)")
+ raise ValueError(f"image_urls must have 1–{max_images} entries")
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)
+ self._validate_resolution(resolution)
payload = {
"prompt": prompt,
@@ -158,18 +184,77 @@ class GeminiOmniAPI:
"trim_end": trim_end,
"duration": duration,
"aspect_ratio": aspect_ratio,
+ "resolution": resolution,
}
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 audio_ids:
+ self._validate_audio_ids(audio_ids)
+ payload["audio_ids"] = audio_ids
+ if character_ids:
+ payload["character_ids"] = character_ids
if seed is not None:
payload["seed"] = seed
return self._post("/gemini-omni-video-edit", payload)
+ # ------------------------------------------------------------------ #
+ # Audio profile & character creation #
+ # ------------------------------------------------------------------ #
+
+ def create_audio_profile(
+ self,
+ audio_id: str,
+ name: str,
+ voice_description: str = "",
+ example_dialogue: str = "",
+ ) -> dict:
+ """Create a named voice profile. Returns {"request_id": "..."}.
+
+ Args:
+ audio_id: Base voice ID to build the profile from (see AUDIO_IDS).
+ name: Display name for the voice profile.
+ voice_description: Optional text description of the voice style.
+ example_dialogue: Optional sample dialogue for voice calibration.
+
+ Returns:
+ {"request_id": "..."} — poll with wait_for_completion to get the profile ID.
+ """
+ self._validate_audio_ids([audio_id])
+ payload = {"audio_id": audio_id, "name": name}
+ if voice_description:
+ payload["voice_description"] = voice_description
+ if example_dialogue:
+ payload["example_dialogue"] = example_dialogue
+ return self._post("/gemini-omni-audio", payload)
+
+ def create_character(
+ self,
+ image_url: str,
+ descriptions: str,
+ character_name: str = "",
+ audio_ids: list = None,
+ ) -> dict:
+ """Create a character from a reference image. Returns {"request_id": "..."}.
+
+ Args:
+ image_url: Publicly accessible URL of the reference image.
+ descriptions: Text description of the character's appearance and traits.
+ character_name: Optional display name for the character.
+ audio_ids: Optional list of voice IDs to associate with the character.
+
+ Returns:
+ {"request_id": "..."} — poll with wait_for_completion to get the character ID.
+ """
+ payload = {"images_list": [image_url], "descriptions": descriptions}
+ if character_name:
+ payload["character_name"] = character_name
+ if audio_ids:
+ self._validate_audio_ids(audio_ids)
+ payload["audio_ids"] = audio_ids
+ return self._post("/gemini-omni-character", payload)
+
# ------------------------------------------------------------------ #
# File upload & result polling #
# ------------------------------------------------------------------ #
@@ -250,6 +335,16 @@ class GeminiOmniAPI:
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.")
+ def _validate_resolution(resolution: str):
+ if resolution not in RESOLUTIONS:
+ raise ValueError(f"resolution must be one of {RESOLUTIONS}, got {resolution!r}")
+
+ @staticmethod
+ def _validate_audio_ids(audio_ids: list):
+ if not isinstance(audio_ids, list):
+ raise ValueError("audio_ids must be a list")
+ if len(audio_ids) > 3:
+ raise ValueError(f"audio_ids may contain at most 3 entries, got {len(audio_ids)}")
+ for aid in audio_ids:
+ if aid not in AUDIO_IDS:
+ raise ValueError(f"audio_id {aid!r} is not valid. See AUDIO_IDS for options.")