domains / media / muapi-media-generation / muapi-media

muapi-media

Skill card

combined

The two skills cover the same MuAPI media generation workflow but differ significantly in scope and implementation. The first skill (davepoon) is strictly limited to image generation and relies on a bundled Python CLI script (`scripts/muapi_media.py`) that abstracts away the HTTP details. The second skill (sickn33) covers both image and video generation, uses raw `curl` and `jq` commands, and provides explicit API contract details (endpoints, headers) that the first skill hides behind the CLI. Because the first skill excludes video and the second includes it, and because the second provides the underlying API mechanics while the first provides a safer, higher-level wrapper, crowning one would hide a valid alternative approach (CLI vs. raw API) and a valid scope difference (image-only vs. image+video).

Repositories

RepositoryPath
davepoon/buildwithclaudeplugins/all-skills/skills/muapi-media/SKILL.md
sickn33/agentic-awesome-skillsplugins/agentic-awesome-skills-claude/skills/muapi-media/SKILL.md

Other copies

RoleRepositoryPath
peerdavepoon/buildwithclaudeplugins/all-skills/skills/muapi-media/SKILL.md
peersickn33/agentic-awesome-skillsplugins/agentic-awesome-skills-claude/skills/muapi-media/SKILL.md
adaptersickn33/agentic-awesome-skillsplugins/agentic-awesome-skills/skills/muapi-media/SKILL.md
adaptersickn33/agentic-awesome-skillsskills/muapi-media/SKILL.md

Combined skill

---
name: muapi-media
category: media
description: Discover current MuAPI media models and run one explicitly confirmed asynchronous generation request with bounded polling. Supports image and video workflows.
---

# MuAPI Media

Use MuAPI's asynchronous API to generate images or videos. You can use the bundled `scripts/muapi_media.py` CLI for a simplified workflow or use raw `curl` commands for full control. The catalog and model schemas are authoritative; do not hard-code endpoints or parameters.

## When to use this skill

- The user wants to generate an image or video using MuAPI.
- The user has explicitly approved a potentially billable request.
- You need to discover the current model endpoints and schemas.

## Setup

Set the API key in the environment. Never pass it as a CLI argument or commit it:

```bash
export MUAPI_API_KEY="your-api-key"
```

`MUAPI_BASE_URL` is optional and defaults to `https://api.muapi.ai`.

## Workflow

### 1. Discover current models

**Option A: Using the CLI (Image only)**
```bash
python3 scripts/muapi_media.py models --category image --query flux
```

**Option B: Using curl (Image and Video)**
```bash
workdir=$(mktemp -d "${TMPDIR:-/tmp}/muapi-media.XXXXXX")

curl --fail --silent --show-error \
  --header "Accept: application/json" \
  "https://api.muapi.ai/api/v1/models" \
  --output "$workdir/models.json"

jq -r '.models[] | [.name, .category, .endpoint] | @tsv' "$workdir/models.json"
```

Select a model from the output. The `endpoint` field already includes the `/api/v1/` prefix.

### 2. Validate Model Schema

Fetch the specific model's schema to determine required parameters.

**Option B: Using curl**
```bash
export MUAPI_MODEL="<model name>"

curl --fail --silent --show-error \
  --header "Accept: application/json" \
  "https://api.muapi.ai/api/v1/models/${MUAPI_MODEL}" \
  --output "$workdir/model.json"

jq '.input_schema.schemas.input_data' "$workdir/model.json"
```

Check required fields, types, and limits. Do not guess parameters.

### 3. Prepare Request

Create a JSON file with the parameters confirmed by the model schema. Ensure `MUAPI_API_KEY` is not in this file.

```json
{
  "prompt": "A clean product photograph",
  "aspect_ratio": "1:1"
}
```

### 4. Confirm and Generate

**Option A: Using the CLI**
```bash
python3 scripts/muapi_media.py generate \
  <model-name> \
  --params-file request.json \
  --confirm-paid
```

**Option B: Using curl**
```bash
model_endpoint=$(jq -er --arg name "$MUAPI_MODEL" '.models[] | select(.name == $name) | .endpoint' "$workdir/models.json")

curl --fail --silent --show-error \
  --request POST \
  "https://api.muapi.ai${model_endpoint}" \
  --header "x-api-key: ${MUAPI_API_KEY}" \
  --header "Content-Type: application/json" \
  --data "@$workdir/request.json" \
  --output "$workdir/submit.json"

request_id=$(jq -er '.request_id // .id' "$workdir/submit.json")
```

### 5. Poll for Results

Poll the prediction endpoint with a finite deadline.

**Option B: Using curl**
```bash
result_url="https://api.muapi.ai/api/v1/predictions/${request_id}/result"

for attempt in $(seq 1 120); do
  curl --fail --silent --show-error \
    "$result_url" \
    --header "x-api-key: ${MUAPI_API_KEY}" \
    --output "$workdir/result.json"
  
  status=$(jq -r '.status // "unknown"' "$workdir/result.json")
  if [ "$status" == "succeeded" ] || [ "$status" == "failed" ]; then
    break
  fi
  sleep 5
done
```

## Safety Rules

- Keep `MUAPI_API_KEY` server-side and out of logs, prompts, and committed files.
- Never retry a generation POST automatically. Require fresh user confirmation for another paid request.
- Poll only with GET and stop at a finite limit.
- Preserve the catalog endpoint path; do not prepend `/api/v1/` if it is already present.
- Download only HTTPS output URLs.
- Require human review for sensitive or regulated content.