Metadata-Version: 2.5
Name: genmagic
Version: 0.1.1
Summary: Official GenMagic client and CLI: one API key and one pay-as-you-go balance for 460+ AI models. Generate images, video with sound, speech, music and text with Veo, Kling, Seedance, Wan, Nano Banana, GPT Image, FLUX and more.
Project-URL: Homepage, https://genmagic.co/developers?utm_source=pypi&utm_medium=package
Project-URL: Get an API key, https://genmagic.co/get-api-key?utm_source=pypi&utm_medium=package
Project-URL: API reference, https://genmagic.co/openapi.json
Author-email: GenMagic <hello@genmagic.co>
License: MIT
License-File: LICENSE
Keywords: ai,flux,generative-ai,genmagic,gpt-image,image-generation,kling,music-generation,nano-banana,openai-compatible,openai-videos-api,seedance,sora,sora-2,sora-alternative,text-to-image,text-to-speech,text-to-video,tts,veo,video-generation,wan
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# 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.

```bash
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

```python
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.

```python
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):

```python
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

```python
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:

```python
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

```python
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

```bash
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](https://genmagic.co/n8n?utm_source=pypi&utm_medium=readme), [Zapier](https://genmagic.co/zapier?utm_source=pypi&utm_medium=readme), [Make](https://genmagic.co/make?utm_source=pypi&utm_medium=readme), [ComfyUI](https://genmagic.co/comfyui?utm_source=pypi&utm_medium=readme) and through [MCP](https://genmagic.co/mcp?utm_source=pypi&utm_medium=readme) in Claude, ChatGPT and Cursor. The REST API is OpenAI-compatible: [reference](https://genmagic.co/developers?utm_source=pypi&utm_medium=readme).
