Get started

Quickstart

Key → storage → create job → poll → MP4 URL.

1. Setup

.env
MANIMOTION_API=https://api.manimotion.dev
MANIMOTION_KEY=chalk_live_sk_v1_...

2. Create

If you saved storage in Settings, omit storage. Otherwise pass storage.inline:

create.sh
curl -sS -X POST "$MANIMOTION_API/video/request" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $MANIMOTION_KEY" \
  -d '{
    "prompt": "Explain Fourier series from waves to frequency",
    "storage": {
      "inline": {
        "provider": "r2",
        "bucket": "my-lectures",
        "access_key_id": "YOUR_R2_ACCESS_KEY",
        "secret_access_key": "YOUR_R2_SECRET",
        "account_id": "YOUR_CLOUDFLARE_ACCOUNT_ID",
        "public_url": "https://cdn.example.com"
      }
    }
  }'
RESPONSEresponse.json
{
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued",
  "cached": false,
  "video_url": null,
  "engine": null
}

3. Poll

poll.sh
curl -sS "$MANIMOTION_API/video/status/$JOB_ID" \
  -H "x-api-key: $MANIMOTION_KEY"
RESPONSEresponse.json
{
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "completed",
  "video_url": "https://cdn.example.com/videos/a1b2c3d4.mp4",
  "error": null,
  "cached": false,
  "engine": "manim",
  "duration": 54.2
}

4. Full loop

loop.sh
JOB=$(curl -sS -X POST "$MANIMOTION_API/video/request" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $MANIMOTION_KEY" \
  -d "{
    \"prompt\": \"Teach the product rule with a visual derivation\",
    \"storage\": {
      \"inline\": {
        \"provider\": \"r2\",
        \"bucket\": \"$R2_BUCKET_NAME\",
        \"access_key_id\": \"$R2_ACCESS_KEY_ID\",
        \"secret_access_key\": \"$R2_SECRET_ACCESS_KEY\",
        \"account_id\": \"$R2_ACCOUNT_ID\",
        \"public_url\": \"$R2_PUBLIC_BASE_URL\"
      }
    }
  }" \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")

echo "job=$JOB"
while true; do
  BODY=$(curl -sS "$MANIMOTION_API/video/status/$JOB" -H "x-api-key: $MANIMOTION_KEY")
  echo "$BODY"
  echo "$BODY" | grep -q '"status": "completed"' && break
  echo "$BODY" | grep -q '"status": "failed"' && exit 1
  sleep 3
done
RESPONSEstdout
https://cdn.example.com/videos/….mp4

More: Storage · API.