# Media Generation

Generate images and videos, remove captions and watermarks.

Generate images, videos, and remove captions/watermarks from videos. All media endpoints use studio credits and follow the same async job pattern — submit a request, receive a `job_id`, then poll `/api/job-status/:job_id` for results. Image and video generation are available on all plans; caption removal requires a Professional or Ultimate plan.

### `POST /api/caption-remover`

Remove captions and watermarks from a video. Accepts a publicly accessible video URL **or a TikTok/Instagram Reel link** — the API downloads and processes the video via AI, then returns a cleaned video uploaded to CDN. Credits are deducted upfront and refunded automatically if processing fails.

**Request Body (JSON)**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| video_url | string | Required | Direct video URL, TikTok link (`https://www.tiktok.com/@user/video/{id}`), or Instagram Reel link (`https://www.instagram.com/reels/{id}/`) |

**Cost:** 12 studio credits per minute of video (0.2 credits per second, rounded up). **Max duration: 90 seconds.** Processing can take up to 30 minutes depending on video length.

**Example Request (Direct URL)**

```
curl -X POST "https://api.algrow.online/api/caption-remover" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video_url": "https://example.com/my-video.mp4"}'
```

**Example Request (TikTok)**

```
curl -X POST "https://api.algrow.online/api/caption-remover" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video_url": "https://www.tiktok.com/@username/video/1234567890123456789"}'
```

**Example Request (Instagram Reel)**

```
curl -X POST "https://api.algrow.online/api/caption-remover" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"video_url": "https://www.instagram.com/reels/DWPuSZWATDC/"}'
```

**Response 200 200**

```
{
  "success": true,
  "job_id": "a5358a1c-388d-47a3-989e-755291031d77",
  "status": "pending",
  "duration_seconds": 28.5,
  "credit_cost": 6,
  "message": "Caption removal queued. Poll /api/job-status/{job_id} for progress."
}
```

**Completed Job Response (via /api/job-status/:job_id)**

```
{
  "success": true,
  "job_id": "a5358a1c-388d-47a3-989e-755291031d77",
  "job_type": "caption_remover",
  "status": "completed",
  "output_url": "https://audio.algrow.online/api/video/caption_remover_abc123.mp4",
  "completed_at": 1774200779.08
}
```

200 Queued 400 Missing video_url 401 Auth failed 402 No credits 403 Plan required 429 Too busy

### `POST /api/generate-image`

Generate AI images from a text prompt. Supports multiple models with optional reference images. Returns one or more image URLs uploaded to CDN. Credits are deducted upfront and refunded automatically if generation fails. Set `fast=true` to bypass the standard ladder for sub-30s outputs (3x the model's base credits, never less than 3).

**Request Body (JSON)**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| prompt | string | Required | — | Text description of the image to generate |
| model | string | Optional | nano-banana-2 | Image model. See model table below. |
| aspect_ratio | string | Optional | 16:9 | Output aspect ratio (e.g. `16:9`, `9:16`, `1:1`, `4:3`) |
| reference_image_url | string | Optional | — | URL of a reference image for style guidance. Required for `seedream-4.5-edit`. |
| reference_image_urls | string[] | Optional | — | Several reference images at once. Takes precedence over `reference_image_url`, which is used as a fallback when only one reference is sent. `nano-banana-pro`, `nano-banana-2`, `seedream-5.0-lite` and `gpt-image-2.5` use the whole list; the others take the first entry only. |
| fast | boolean | Optional | false | Fast mode — bypasses the standard provider ladder for sub-30s outputs. **Costs 3x the model's base credits, never less than 3.** Same models and prompt; reference images still work. |
| use_own_key | boolean | Optional | true | Use your own provider key for this render when you have one configured. Set to `false` to spend Algrow credits instead. No effect if you haven't added a key. |

**Bring your own key and the render is free.** Add a provider key at [Settings](https://algrow.online/settings) and any model it covers renders on that key at **0 Algrow credits** — you pay the provider directly. It applies automatically; the `credits_used` field in the response comes back as `0` so you can tell which path a job took. Pass `use_own_key: false` on a request you would rather bill to credits.

**Available Models**

| Model | Credits | Notes |
| --- | --- | --- |
| `gpt-image-2.5` | 0.35 | OpenAI GPT Image 2.5 — text-to-image, or image-to-image when `reference_image_url` is supplied |
| `nano-banana-2` | 1 | Fast general-purpose generation (default) |
| `nano-banana-pro` | 2 | Higher quality, supports up to 8 reference images |
| `seedream-4.5-edit` | 1 | Image editing — requires `reference_image_url` |
| `seedream-5.0-lite` | 1 | Lightweight generation, optional reference |

**Example Request**

```
curl -X POST "https://api.algrow.online/api/generate-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a sunset over mountains, photorealistic", "model": "nano-banana-2", "aspect_ratio": "16:9"}'
```

**Example Request (fast mode)**

```
curl -X POST "https://api.algrow.online/api/generate-image" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a sunset over mountains, photorealistic", "model": "nano-banana-2", "aspect_ratio": "16:9", "fast": true}'
```

**Response 200 200**

```
{
  "success": true,
  "job_id": "536c20ce-5ee6-4b8d-9f7f-3994014c896e",
  "status": "pending",
  "credits_used": 1,
  "message": "Image generation queued. Poll /api/job-status/{job_id} for progress."
}
```

**Completed Job Response (via /api/job-status/:job_id)**

```
{
  "success": true,
  "job_id": "536c20ce-5ee6-4b8d-9f7f-3994014c896e",
  "job_type": "image",
  "status": "completed",
  "image_urls": ["https://audio.algrow.online/api/images/user123/1774201509_0_5b0a0050.png"],
  "completed_at": 1774201512.99
}
```

200 Queued 400 Validation error 401 Auth failed 402 No credits 403 Plan required 429 Too busy

### `POST /api/generate-video`

Generate AI videos from a text prompt. Supports multiple models including Sora, Veo, Seedance, Kling, and Grok. Returns a video URL uploaded to CDN. Credits are deducted upfront and refunded automatically if generation fails.

**Request Body (JSON)**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| prompt | string | Required | — | Text description of the video to generate |
| model | string | Optional | sora-2 | Video model. See model table below. |
| input_reference_url | string | Conditional | — | Reference image URL. Required for `kling-2.6` and `grok-image-to-video`. Optional on every other model. |
| seconds | string | Optional | 4 | Video duration in seconds (Sora only). Values: `4`, `8`, `12`. Anything else falls back to `4`. |
| size | string | Optional | 720x1280 | Output resolution (Sora only). Values: `720x1280`, `1280x720`, and on `sora-2-pro` also `1024x1792`, `1792x1024`. Any other value returns 400 — there is no 1080p Sora tier. |
| duration | string | Optional | 5 | Video duration for Kling (`5` or `10`), Grok (`6`–`30`) and Seedance (`4`–`15`; `1`–`30` on `seedance-2-5`). Out-of-range values are clamped, and you are billed the clamped duration. |
| resolution | string | Optional | — | Output resolution for Veo (`720p`, `1080p`, `4k`), Grok (`480p`, `720p`, `1080p`) and Seedance (`480p`, `720p`, plus `1080p` / `4k` on `seedance-2`). Unsupported values fall back to the model's default tier. |
| sound | boolean | Optional | false | Enable audio generation (Kling and Seedance). Raises the credit cost. `seedance-2-5` includes audio at no extra cost. |
| aspect_ratio | string | Optional | 9:16 | Output aspect ratio (Veo only). e.g. `9:16`, `16:9` |

**Available Models**

| Model | Credits | Reference Image | Notes |
| --- | --- | --- | --- |
| `sora-2` | 14 / 27 / 40 | Optional | OpenAI Sora 2, 720p. Cost by `seconds`: 4s / 8s / 12s |
| `sora-2-pro` | 40 / 80 / 120 (720p) 67 / 134 / 200 (1024p) | Optional | Sora 2 Pro. Cost by `seconds` 4s / 8s / 12s, and by `size` tier |
| `veo3-lite` | 5 / 6 / 25 | Optional | Google Veo 3.1 Lite. Cost by `resolution`: 720p / 1080p / 4k |
| `veo3-fast` | 10 / 11 / 30 | Optional | Veo 3.1 Fast. Cost by `resolution`: 720p / 1080p / 4k |
| `veo3-quality` | 42 / 43 / 62 | Optional | Veo 3.1 Quality. Cost by `resolution`: 720p / 1080p / 4k |
| `kling-2.6` | 10 / 19 19 / 37 with sound | Required | Image-to-video. Cost by `duration` 5s / 10s, doubled by `sound` |
| `grok-image-to-video` | 3 – 40 | Required | Grok image-to-video. Billed per second by `duration` (6–30s) and `resolution` |
| `grok-text-to-video` | 3 – 40 | Optional | Grok text-to-video. Same per-second rates as above |
| `seedance-2-mini` | 4 – 52 | Optional | Cheapest Seedance tier. 480p / 720p, 4–15s, optional `sound` |
| `seedance-2-fast` | 6 – 83 | Optional | Faster Seedance tier. 480p / 720p, 4–15s, optional `sound` |
| `seedance-2` | 8 – 520 | Optional | Full Seedance. Adds 1080p and 4k, 4–15s, optional `sound` |
| `seedance-2-5` | 5 – 315 | Optional | Newest Seedance, up to 30s. 480p / 720p only; audio is included at no extra cost |

**Costs are computed from the parameters you send.** Duration is clamped and resolution snapped to the nearest supported tier before billing, so the credits you are charged always match the video you get back. The exact figure is in the `credit_cost` field of the 200 response.

**Example Request (Sora)**

```
curl -X POST "https://api.algrow.online/api/generate-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "a cat walking through flowers", "model": "sora-2", "seconds": "4", "size": "720x1280"}'
```

**Example Request (Kling with reference image)**

```
curl -X POST "https://api.algrow.online/api/generate-video" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "person waving at camera", "model": "kling-2.6", "input_reference_url": "https://example.com/photo.jpg", "duration": "5"}'
```

**Response 200 200**

```
{
  "success": true,
  "job_id": "e58464d7-ae8d-41b2-8c52-79bac92b1bb9",
  "status": "pending",
  "credit_cost": 14,
  "message": "Video generation queued. Poll /api/job-status/{job_id} for progress."
}
```

**Completed Job Response (via /api/job-status/:job_id)**

```
{
  "success": true,
  "job_id": "e58464d7-ae8d-41b2-8c52-79bac92b1bb9",
  "job_type": "video",
  "status": "completed",
  "video_url": "https://audio.algrow.online/sora/videos/user123/video_abc123.mp4",
  "completed_at": 1774200881.01
}
```

**Processing time:** Video generation can take 30 seconds to 30 minutes depending on the model and duration. Poll `/api/job-status/:job_id` every 5 seconds for updates.

200 Queued 400 Validation error 401 Auth failed 402 No credits 403 Plan required 429 Too busy
