Multimodal media generation CLI for Google GenAI
Project description
genmedia
Multimodal media generation CLI for Google GenAI. Images, video, and image editing from the terminal. Bring your own API key.
Examples
| Generate | Edit | Generate |
|---|---|---|
genmedia image "a cat on a skateboard" |
before editing | genmedia image "a glowing crystal orb floating in darkness" |
genmedia image "a slightly glowing crystalline cat in the morning light in a forest, sharp, magical realism" |
genmedia edit red_triangle.jpg "change to blue, yellow gradient background" |
https://github.com/user-attachments/assets/46beecf4-a12a-4983-be7e-5ce516b8b803
Install
# uv (fastest)
uv tool install genmedia
# or run without installing
uvx genmedia image "a cat on a skateboard" --pretty
# pipx
pipx install genmedia
# pip
pip install genmedia
Requires Python 3.11+.
Setup
Get a Gemini API key and set it:
export GEMINI_API_KEY="your-key-here"
Usage
Generate images
# Simple
genmedia image "a cat on a skateboard" --pretty
# Full control
genmedia image "abstract gradient, soft pastels" \
--model gemini-3.1-flash-image-preview \
--size 4K \
--aspect 16:9 \
--output backgrounds/pastel.png
# Batch
genmedia image "product mockup on marble" --count 3 --output-dir shots/
# Using Imagen
genmedia image "photorealistic mountain lake" --model imagen-4.0-generate-001
Edit images
genmedia edit input.png "remove the background" --pretty
genmedia edit photo.jpg "make the sky more dramatic" -o edited.jpg
Generate video
# Text-to-video
genmedia video "a cat riding a skateboard downhill at sunset" --duration 8 --pretty
# Image-to-video (animate a still image)
genmedia video "the scene comes to life" --image keyframe.jpg --pretty
# Style reference (apply visual style from an image)
genmedia video "a bustling city street" --style-ref painting.jpg
# Asset reference (character/object consistency, up to 3 images)
genmedia video "the character walks through a forest" --asset-ref character.png
Note:
--last-frame(frame interpolation) is available in the CLI but currently only supported by Veo 2 (veo-2.0-generate-001), which requires a Google Cloud Vertex AI billing account. It is not supported on Veo 3.x models.
List models
genmedia image --list-models
genmedia video --list-models
Piping
# Pipe prompt from stdin
echo "a neon cityscape at night" | genmedia image --pretty
# Write binary to stdout
genmedia image "a logo" --output - > logo.png
# Read image from stdin for video
cat keyframe.png | genmedia video "animate this" --image - --pretty
Dry run
genmedia image "test" --dry-run # shows request payload without calling API
Output
JSON by default (for AI agents and scripts):
{
"status": "success",
"files": [
{
"path": "/tmp/genmedia/genmedia_001.jpg",
"mime_type": "image/jpeg",
"size_bytes": 534182
}
],
"model": "gemini-3.1-flash-image-preview",
"elapsed_seconds": 14.3,
"request": {
"prompt": "a cat on a skateboard",
"aspect_ratio": "16:9"
}
}
Use --pretty for human-friendly output:
Saved to /tmp/genmedia/genmedia_001.jpg (521.7 KB)
Model: gemini-3.1-flash-image-preview | Time: 14.3s
Errors go to stderr as JSON with distinct exit codes:
0— success1— API error (rate limit, server error, content blocked)2— validation error (bad params, missing API key)3— file I/O error
Models
Image generation
| Model | Notes |
|---|---|
gemini-3.1-flash-image-preview |
Default. Best quality. |
gemini-3-pro-image-preview |
Previous generation. |
gemini-2.5-flash-image |
Older, faster. |
imagen-4.0-generate-001 |
Imagen. Different API, good for photorealism. |
Video generation
| Model | Notes |
|---|---|
veo-3.0-generate-001 |
Default. Standard quality. |
veo-3.0-fast-generate-001 |
Faster, lower quality. |
veo-3.1-generate-preview |
Newer preview. |
veo-3.1-fast-generate-preview |
Newer fast preview. |
veo-2.0-generate-001 |
Veo 2. Supports --last-frame. Requires Vertex AI billing. |
For AI agents
genmedia is designed to be called by AI agents. JSON output by default, structured errors on stderr, distinct exit codes for branching. No interactive prompts, no spinners unless --pretty is set.
import subprocess, json
result = subprocess.run(
["genmedia", "image", "a logo for my app", "--aspect", "1:1"],
capture_output=True, text=True
)
if result.returncode == 0:
data = json.loads(result.stdout)
image_path = data["files"][0]["path"]
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file genmedia-0.2.1.tar.gz.
File metadata
- Download URL: genmedia-0.2.1.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffcd1bd82a4f33c20c8dcb0b5301a71db33903f4b48f8f1d9d912f13c5c09277
|
|
| MD5 |
f54224167f9e8b408158f8ada84519b1
|
|
| BLAKE2b-256 |
f4f5c663e229ddb1fea609dda86f3a77657a4fb708fa8e7d951957f6b8221464
|
File details
Details for the file genmedia-0.2.1-py3-none-any.whl.
File metadata
- Download URL: genmedia-0.2.1-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
073db46b8787f1e27adc4bb15fa831fba868b399abd36263828586afd519711e
|
|
| MD5 |
2a766c7041e61b8c72104c3ceddb74b1
|
|
| BLAKE2b-256 |
2b412212c077dd4be4511c5ffbfcab5894467fca0fccac40b61a7e223b0c4210
|