AI powered cost-effective content creation 🧪
Project description
🧪 mediaichemy: cost-effective AI powered content creation
mediaichemy is a Python library for generating cheap and cost effective multimedia content using AI. It intelligently selects models and workflows to minimize costs while delivering high-quality results.
The library relies on:
- Runware for image and video generation
- OpenRouter for general AI and text completions
- Piper TTS: text-to-speech synthesis
Usage ovewview
mediaichemy offers a simple yet powerful approach to content creation:
- Media: Choose a specific media type and edit its parameters to create the content you want.
- MediaCreator Use AI to generate content ideas for you and create them.
Both approaches use the same underlying Media system, with MediaCreator adding an AI layer that handles the creative decisions for you. All content creation automatically optimizes for cost-effectiveness by choosing the best-performing, lowest-cost AI models.
What's Inside
🎬 Media
Getting Started
- Install mediaichemy directly from PyPI:
pip install mediaichemy
- Set up API keys for OpenRouter and Runware (see below).
Setting up API keys
1. Create an OpenRouter Account
- Obtain an Openrouter API key
2. Create a Runware Account
- Obtain a Runware API key
3. Configure your API keys as environment variables:
Linux/macOS (Terminal):
export OPENROUTER_API_KEY="your_openrouter_api_key"
export RUNWARE_API_KEY="your_runware_api_key"
Windows (Command Prompt):
set OPENROUTER_API_KEY=your_openrouter_api_key
set RUNWARE_API_KEY=your_runware_api_key
Windows (PowerShell)
$env:OPENROUTER_API_KEY="your_openrouter_api_key"
$env:RUNWARE_API_KEY="your_runware_api_key"
Option 2: Use a .env File
Create a file named .env in your project root with the following content:
OPENROUTER_API_KEY=your_openrouter_api_key
RUNWARE_API_KEY=your_runware_api_key
Media
Each Media type creates a specific form of content using AI and editing tools to craft it.
Single Media Examples
Media created using a single AI source.
Image
from mediaichemy.media.single import Image
from mediaichemy.media.parameters import ImageParameters
image_params = ImageParameters(
image_prompt="A cat on a skateboard",
image_model="rundiffusion:110@101"
)
image = await Image(params=image_params).create()
Video
from mediaichemy.media.single import Video
from mediaichemy.media.parameters import VideoParameters
video_params = VideoParameters(
video_prompt="A dog floating in outer space",
video_model="bytedance:1@1",
width=1088,
height=1920
)
video = await Video(params=video_params).create()
https://github.com/user-attachments/assets/da8a297b-3808-49e1-b635-7358339a0d49
Narration
from mediaichemy.media.single import Narration
from mediaichemy.media.parameters import NarrationParameters
narration_params = NarrationParameters(
narration_text=("A student asked the master, "
"What is the sound of one hand clapping? "
"The master simply held up his hand."),
narration_voice_name="en_US-joe-medium",
narration_silence_tail=5,
narration_speed=1.0
)
narration = await Narration(params=narration_params).create()
Multi Media Examples
Media created combining multiple AI sources.
Image Video
A video created by first creating an image, then animating it. Enabling more customization on the starter image.
from mediaichemy.media.multi import ImageVideo
from mediaichemy.media.parameters import ImageVideoParameters
image_video_params = ImageVideoParameters(
video_prompt="A hyper realistic pink mantis wearing a tuxedo.",
image_model="rundiffusion:110@101",
video_model="bytedance:1@1",
width=1088,
height=1920
)
image_video = await ImageVideo(params=image_video_params).create()
https://github.com/user-attachments/assets/515ea7ee-2084-44eb-a4b8-90cb4602e4a7
Storyline Video
from mediaichemy.media.multi import StorylineVideo
from mediaichemy.media.parameters import StorylineVideoParameters
storyline_video_params = StorylineVideoParameters(
video_prompt="A forest in the rain",
image_model="rundiffusion:110@101",
video_model="bytedance:1@1",
width=1088,
height=1920,
narration_text="Listen to the rain.",
narration_voice_name="en_US-joe-medium",
narration_silence_tail=5,
narration_speed=1.0,
background_relative_volume=0.5,
background_audio_paths=[],
subtitle_fontname="Arial",
subtitle_fontsize=18,
subtitle_color="#FFEE00C7",
subtitle_outline_color="#000000",
subtitle_positions=["bottom_center", "top_center", "middle_center"]
)
storyline_video = await StorylineVideo(params=storyline_video_params).create()
https://github.com/user-attachments/assets/16e9170f-eab2-442a-a8d5-87204acbd662
Using the MediaCreator
By using MediaCreator, you let AI create ideas for you. You can use it to generate content for a specific media type or let it pick the best type for you automatically based on your prompt.
MediaCreator
Using MediaCreator with a specific media type
from mediaichemy.creator import MediaCreator
from mediaichemy.media import StorylineVideo
creator = MediaCreator(
creator_model='anthropic/claude-sonnet-4.5',
media_type=StorylineVideo)
media = await creator.create(user_prompt=(
"Create a short video telling a zen koan."
"The video features a hyperrealistic detailed natural setting."),
narration_voice_name='en_US-joe-medium')
https://github.com/user-attachments/assets/4dbaf275-0070-4117-a816-f5c775d39c91
Letting MediaCreator pick the best media type
from mediaichemy.creator import MediaCreator
creator = MediaCreator() # No media_type specified
media = await creator.create(
user_prompt="Create an image of a dog wearing a space helmet."
)
Project details
Release history Release notifications | RSS feed
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 mediaichemy-1.1.1.tar.gz.
File metadata
- Download URL: mediaichemy-1.1.1.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ee72c458514ccb5e21b72b6cf9298d0d316c85920d8763587a90eee071bd715
|
|
| MD5 |
dccac9e066188a99f2b190f80b8a518d
|
|
| BLAKE2b-256 |
26aeda9509e8a0e9ba39d7e8bf30dfa488de043286e4348bf752307eaae12cdc
|
Provenance
The following attestation bundles were made for mediaichemy-1.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on pedroblayaluz/mediaichemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mediaichemy-1.1.1.tar.gz -
Subject digest:
2ee72c458514ccb5e21b72b6cf9298d0d316c85920d8763587a90eee071bd715 - Sigstore transparency entry: 856945655
- Sigstore integration time:
-
Permalink:
pedroblayaluz/mediaichemy@66e16fd754cb64ce6791ecb88117242f4799cd30 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/pedroblayaluz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@66e16fd754cb64ce6791ecb88117242f4799cd30 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mediaichemy-1.1.1-py3-none-any.whl.
File metadata
- Download URL: mediaichemy-1.1.1-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6393b94a8a9cce856ad075a5d443a8d3af6951b150fac93e12c56b9aac384b11
|
|
| MD5 |
54d6444007d3f732120d3a8e03586b9a
|
|
| BLAKE2b-256 |
b9d43b72363604ae55714ddb91e636d2a56ff1e8c1c6f16bbf039934c7832fd9
|
Provenance
The following attestation bundles were made for mediaichemy-1.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on pedroblayaluz/mediaichemy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mediaichemy-1.1.1-py3-none-any.whl -
Subject digest:
6393b94a8a9cce856ad075a5d443a8d3af6951b150fac93e12c56b9aac384b11 - Sigstore transparency entry: 856945714
- Sigstore integration time:
-
Permalink:
pedroblayaluz/mediaichemy@66e16fd754cb64ce6791ecb88117242f4799cd30 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/pedroblayaluz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@66e16fd754cb64ce6791ecb88117242f4799cd30 -
Trigger Event:
release
-
Statement type: