---
name: mixmedia
description: Generate images, videos and music with the MixMedia API (Nano Banana, GPT Image, Seedream, FLUX, Seedance, Kling, Veo, Wan, Suno and more), get exact prices and the account balance. Use when the user asks to create, edit or animate a picture, make a video or a song through MixMedia, or asks which MixMedia model fits a task and how much it costs.
---

# MixMedia: images, video and music by API

Reply in the user's language. All requests are plain HTTPS calls with `curl`.

## The API key

- The key is in the environment variable `MIXMEDIA_API_KEY` (it starts with `sk-aim-`).
- Never print, echo, log or write the key into files, code, commits or chat. Always reference it as `"$MIXMEDIA_API_KEY"` (PowerShell: `$env:MIXMEDIA_API_KEY`).
- If the variable is empty, ask the user to create a key at https://mixmedia.tech/cabinet/keys and set the variable in their terminal. Do not ask them to paste the key into the chat.
- Steps 1 and 2 need no key and cost nothing.

Base URL: `https://mixmedia.tech/api/v1`. Auth header: `Authorization: Bearer $MIXMEDIA_API_KEY`.

## 1. Pick a model (free, no key)

```bash
curl -s https://mixmedia.tech/api/v1/models
```

`data[]` has `id`, `name`, `category` (`image`, `video`, `audio`, `text`), `price` in USD, `prices` by resolution and `params` (the fields of `input`, with `required`, `options`, `max`).
Full model docs as Markdown: index https://docs.mixmedia.tech/en/llms.txt, one page per model under https://docs.mixmedia.tech/en/models/. Read the model page before you build `input` for an unfamiliar model.

## 2. Get the exact price (free, no key)

```bash
curl -s "https://api.mixmedia.tech/v1/pricing/calculate?model=seedance-2.0&resolution=720p&duration=5"
```

Images: pass `resolution` or `quality` if the model has them. Video: `resolution`, `duration` and, if used, `reference_images`, `generate_audio`.
Show the user the price in USD and wait for an explicit yes before step 4. Every generation is charged from the user's balance.

## 3. Local files (optional)

Models take public https links in `image_urls`, `video_urls` and similar fields. For a local file, upload it first:

```bash
curl -s -X POST https://mixmedia.tech/api/v1/files/upload \
  -H "Authorization: Bearer $MIXMEDIA_API_KEY" \
  -F "file=@photo.jpg"
```

Use `data.url` from the response.

## 4. Create the task

```bash
curl -s -X POST https://mixmedia.tech/api/v1/jobs/createTask \
  -H "Authorization: Bearer $MIXMEDIA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <unique id>" \
  -d '{"model":"nano-banana-2","input":{"prompt":"A glass perfume bottle on wet black stone, studio light"}}'
```

The response has `data.taskId`. Keep the same `Idempotency-Key` if you retry the same request: it will not create or charge a second task.

## 5. Wait for the result

```bash
curl -s "https://mixmedia.tech/api/v1/jobs/recordInfo?taskId=<taskId>" \
  -H "Authorization: Bearer $MIXMEDIA_API_KEY"
```

Ask every 5 seconds until `data.state` is `success` or `fail`. Images usually take 10–90 s, video 1–10 min.
On `success`, `data.resultJson` is a JSON string with `resultUrls`. The links live 24 hours: download the files into the project (`curl -L -o file.png <url>`) and tell the user where they are.
On `fail`, the money is refunded automatically; show `failMsg` and ask before trying again.

## Balance

```bash
curl -s https://mixmedia.tech/api/v1/user/balance -H "Authorization: Bearer $MIXMEDIA_API_KEY"
```

## Errors

- 401: the key is wrong or deleted. Ask the user to check `MIXMEDIA_API_KEY`.
- 402: not enough balance. Top up at https://mixmedia.tech/cabinet/billing.
- 400: an `input` field is missing or wrong (see `msg`). Re-read the model's `params` and fix it.
- 429: too many requests. Wait a minute.

## Rules

- Confirm the price before every paid task. Run one task at a time unless the user asks for more.
- Do not loop paid retries. One retry at most, and only with the user's consent.
- Text models (Claude, GPT, Gemini) for coding agents live at https://api.mixmedia.tech/v1 (OpenAI format) and https://api.mixmedia.tech (Anthropic and Gemini formats). Setup guides: https://mixmedia.tech/en/api/guides
