Skip to main content

MediaAgent

PyPI version Python License Build Downloads

AI-powered image generation with natural language. Features an interactive CLI with multiple LLM providers and image backends.

Quick Start

# Install
pip install -e .

# Start the CLI
media-agent

Setup

1. Install

python -m venv .venv
source .venv/bin/activate

# Basic install
pip install -e .

# With cloud LLM providers (recommended)
pip install -e ".[all-llm]"

2. Configure an LLM Provider

Choose one:

OpenAI (easiest)

/settings openai.api_key sk-your-key-here
/llm openai

Anthropic

/settings anthropic.api_key sk-ant-your-key-here
/llm anthropic

Ollama (free, local)

# Install Ollama first: https://ollama.ai
ollama pull llama3.2
ollama serve
/llm ollama llama3.2

Local HuggingFace (requires GPU)

media-agent download llm
/llm huggingface

3. Configure Image Generation

Local GPU (default, requires CUDA GPU)

media-agent download image
/image local

Nanobanana Cloud (no GPU needed)

/settings nanobanana.api_key your-key-here
/image nanobanana

4. Generate Images

Just chat naturally:

> Generate a sunset over mountains
> Create a cyberpunk city at night
> A cat wearing a tiny hat

Or use the direct command:

/generate a beautiful forest landscape

CLI Commands

Command Description
/help Show all commands
/generate <prompt> Generate an image
/llm <provider> Switch LLM (openai, anthropic, ollama, huggingface)
/image <provider> Switch image backend (local, nanobanana)
/settings <key> <value> Configure settings
/resolutions Show available image sizes
/unload Free GPU memory
/clear Clear chat history
/quit Exit

Command Line Usage

# Interactive mode
media-agent

# Generate directly
media-agent generate "a sunset over mountains"

# With options
media-agent generate "a cat" -r 1024x1024 -s 42

# Download models
media-agent download all

# Manage settings
media-agent settings list
media-agent settings openai.api_key sk-xxx

Python API

from media_agent import MediaAgent

# Using configured settings
agent = MediaAgent()
result = agent.run("Generate a sunset over mountains")
print(result)

# Specify providers
agent = MediaAgent(
    llm_provider="openai",
    llm_model="gpt-4o",
    image_provider="local",
)

# Direct generation (skip LLM)
path = agent.generate(
    prompt="A serene Japanese garden",
    resolution="1344x768",
    seed=42,
)

# Cleanup
agent.unload()

Image Resolutions

Name Size Best For
1024x1024 Square Balanced compositions
1344x768 16:9 Landscapes, wide scenes
768x1344 9:16 Portraits, tall subjects
1152x896 4:3 Slight landscape
896x1152 3:4 Slight portrait

Settings Location

Settings are stored in ~/.config/media_agent/settings.json. No environment variables needed.

Requirements

  • Python >= 3.10
  • For local image generation: CUDA GPU with 8GB+ VRAM
  • For cloud providers: API key only

License

MIT

Metadata

Release files for media-agent 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for media-agent 0.3.1
File Size Uploaded
media_agent-0.3.1.tar.gz 50.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for media-agent 0.3.1
File Interpreter ABI Platform
media_agent-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 107.3 kB

Release files / media_agent-0.3.1.tar.gz

Download URL media_agent-0.3.1.tar.gz
Size 50.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e168f7c995c95195cd7ef123b4a07ecc0c3aff0f16c781e884efc7320ae1c279
BLAKE2b-256 checksum
How to use checksums
2f95d5a21c3c7aa40770e3dbec410838bdbceca357e1497441123c7eb3b48bc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 4, 2026.

Transparency log

Release files / media_agent-0.3.1-py3-none-any.whl

Download URL media_agent-0.3.1-py3-none-any.whl
Size 57.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9264e381ba6ba3568470742c7c64c6fac6b09a4077770baab3dbc281d90a254c
BLAKE2b-256 checksum
How to use checksums
4c255d160623bc78e0c3c7a19ddf689e46c4f79abbc6759d7f2a62533b01914f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page