GenMagic for Python and the command line
One API key and one pay-as-you-go balance for 460+ AI models: images, video with sound, speech, music and text. Veo, Kling, Seedance, Wan, Hailuo, Runway, Nano Banana, GPT Image, FLUX, Seedream and more, each with its price shown before you run it.
pip install genmagic
export GENMAGIC_API_KEY=... # free key, one minute: https://genmagic.co/get-api-key?utm_source=pypi&utm_medium=readme
No dependencies. Python 3.9 or newer.
Images
from genmagic import GenMagic
gm = GenMagic()
image = gm.image("A red fox in snow, 35mm photo", model="google/gemini-nano-banana-2.1", size="1792x1024")
print(image.url, image.cost_cents)
image.save("fox.png")
Video
video starts the job and waits for the clip. Use start_video and get_video to poll yourself.
clip = gm.video("Waves at sunset, slow drone shot", model="alibaba/wan-3.0", aspect_ratio="9:16", duration=5, sound=True)
clip.save("waves.mp4")
Moving off OpenAI's Sora 2 API
OpenAI shut down the Sora 2 Videos API on September 24, 2026. GenMagic answers the same calls, so code built on the
OpenAI SDK keeps working with a new base URL and key, and even model="sora-2" runs (on Veo 3.1 Fast):
from openai import OpenAI
client = OpenAI(base_url="https://genmagic.co/api/v1", api_key=GENMAGIC_API_KEY)
video = client.videos.create_and_poll(model="sora-2", prompt="A paper boat at dusk", seconds="8", size="1280x720")
Details and prices: https://genmagic.co/sora-2-api-alternative?utm_source=pypi&utm_medium=readme
Speech, music, text
gm.speech("Welcome to the show").save("welcome.mp3")
gm.music("Calm lo-fi beat, 80 bpm").save("track.mp3")
print(gm.chat("Write a hook for a video about foxes", model="anthropic/claude-haiku-5.5").text)
Tools for AI agents
genmagic.tools holds typed functions with docstrings, which CrewAI, Agno, Pydantic AI, smolagents, Google ADK, Strands and the OpenAI Agents SDK accept as tools:
from genmagic.tools import generate_image, generate_video, text_to_speech, list_models
agent = Agent(tools=[generate_image, generate_video, text_to_speech, list_models])
Models and prices
video_models = gm.models("video") # needs no key
balance = gm.usage()
A refusal raises GenMagicError with status, code and GenMagic's own message (for example how to top up when the balance is too low).
Command line
genmagic image "A red fox in snow" --out fox.png
genmagic video "Waves at sunset" --aspect 9:16 --duration 5 --out waves.mp4
genmagic speech "Welcome to the show" --out welcome.mp3
genmagic models video
genmagic balance
Also from GenMagic
The same key works in n8n, Zapier, Make, ComfyUI and through MCP in Claude, ChatGPT and Cursor. The REST API is OpenAI-compatible: reference.
Metadata
Release files for genmagic 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| genmagic-0.1.1.tar.gz | 9.5 kB | Without provenance | Details for genmagic-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| genmagic-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for genmagic-0.1.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / genmagic-0.1.1.tar.gz
| Download URL | genmagic-0.1.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5917ea8e5bf7a3f2aeb53cb02d82da9b92a7d9f1bdb012672a01b31b3796cc10
|
|
BLAKE2b-256 checksum How to use checksums |
b363e4af745158ff71ea90dd270f3a4dbecfb34a12b31516e0db852b3cf49933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / genmagic-0.1.1-py3-none-any.whl
| Download URL | genmagic-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a09020d8a5aafd5a5e8017977b4e487b554c2e13503d8d0d5cd0d0f8f6cb9071
|
|
BLAKE2b-256 checksum How to use checksums |
e97a3c36f66f4ba9751d2c3b2d5359233290015c3550eb4d1b1842ec84227ebe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for genmagic 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.