> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Clips

> Turn a long video into its best short moments — framed for vertical, optionally captioned — as a job you submit, poll and collect.

You send one link to a long video — a podcast, a keynote, a stream. The whole video is read and its best moments come back as several short clips, each a published [file](https://vetta.sh/docs/api/files.md) in your library with a title, a virality score and ready-to-post copy. You don't pick the moment and there is no clip count: the job finds them. It is the same pipeline the [`clip_video`](https://vetta.sh/docs/capabilities/tools) tool runs in a session.

Clipping is asynchronous: a submit is answered `202` with a `media_job` you poll (or receive by [webhook](https://vetta.sh/docs/api/webhooks.md)), or wait on with the SDK's `media.clips.wait` or the CLI's `--wait`.

## How clips are picked and framed

* **Picked from what is said.** The video is transcribed with its speaker turns and scored; a moment is a stretch of speech that stands on its own. A video with no speech (music, crowd noise, silent gameplay) gives no clips.
* **Whole sentences, clean edges.** Each clip starts and ends on a full sentence, and is cut on the pause between words with a short lead-in, so the first word is never clipped. `start_seconds` / `end_seconds` in the result are that padded window of the source.
* **`9:16` is full-screen and framed shot by shot** — 1080×1920, no letterbox bars:
  * **Track:** one person talking — the frame follows them with a smooth camera move.
  * **Split:** two people talking in turn — they are stacked, one on top of the other.
  * **Fit:** slides, screen shares, wide shots and cartoons — the whole picture is kept, on a blurred copy of itself. A slide's own black borders are trimmed first, so it fills the width of the frame.
    A moment that shows nobody on screen for most of it (a run of lecture slides) is skipped at `9:16`, unless the whole video has nobody on screen.
    Subtitles already burned into the source are cropped out, so they never collide with new captions.
* **`16:9` is kept as shot.** No reframing; the clip is the source's own picture.
* **Captions** burn in only when `caption_preset` asks for them (the default here is `none`). They sit in a safe zone at about 71% of the frame height, clear of the platforms' buttons, at most two lines at a time, with filler words (um, uh) left out. `clean`, `bold` and `karaoke` are the looks.
* **`remove_silence`** tightens the pauses inside each clip after it is cut, so `duration_seconds` can be shorter than `end_seconds − start_seconds`. Captions and the `9:16` framing follow the tightened clip.

## The media job object

**id** `string`

Unique id (e.g. `med_01H...`).

**object** `string`

Always `media_job`.

**kind** `string`

Always `clip` here.

**status** `string`

`queued` → `processing` → `completed` | `failed`.

**model** `string | null`

Always `null` for clipping; the pipeline is not model-selectable.

**input** `object`

The request as accepted, defaults filled in. Fields you did not send are `null`.

**result** `object | null`

`{ clips: [...] }` once `completed`, otherwise `null`. Each clip:

* `file_id` — the clip, a published file.
* `title` — the scorer's title, else your `title`.
* `start_seconds`, `end_seconds` — the window of the source the clip was cut from, lead-in included.
* `duration_seconds` — the finished clip's length (shorter than the window when `remove_silence` trimmed it).
* `virality` — `total`, `shareability`, `hook_strength`, `story_quality`, `emotional_impact`, each an integer 0–100.
* `hook`, `hook_text`, `tiktok_caption`, `instagram_caption`, `youtube_title` — ready-to-post copy for the clip; each `null` when the scorer gave none.

**error** `object | null`

`{ code, message }` once `failed`, otherwise `null`. See [When a job fails](#when-a-job-fails).

**cost\_micro\_usd** `integer | null`

What the job actually cost, settled on completion. `null` until then and for a failed job — a failure is not billed.

**session\_id** `string | null`

Always `null` for a job submitted here; set when the `clip_video` tool queued it.

**created\_at** `string`

Submission timestamp.

**completed\_at** `string | null`

When the job reached a terminal status.

## Submit a clipping job

`POST /v1/media/clips` — scope `agents:write`. An [`Idempotency-Key`](https://vetta.sh/docs/api/overview#idempotency) header is **required** — a submit without one is refused with `validation_failed` — so a retried submit replays the job instead of queueing (and billing) a second one; the same key with a different body is `idempotency_conflict`.

**video\_url** `string` *required*

A public `http(s)` link to the long video — a page (YouTube, Vimeo) or a direct file. At most 90 minutes. Private, loopback and link-local hosts are refused with `validation_failed`.

**aspect\_ratio** `string` (default: 9:16)

`9:16`: full-screen 1080×1920, framed per shot ([how](#how-clips-are-picked-and-framed)). `16:9`: kept as shot.

**remove\_silence** `boolean` (default: false)

Tighten pauses inside each clip.

**caption\_preset** `string` (default: none)

`none`, `clean`, `bold` or `karaoke`. **The default here is `none` — no captions.** Send a look to burn them in. (The `clip_video` tool, unlike this route, picks a look per video when it isn't given one.)

**language** `string`

BCP-47 hint for transcription (e.g. `de`, `pt-BR`). Omit to detect.

**min\_seconds** `integer` (default: 15)

Shortest clip to keep, 5–180.

**max\_seconds** `integer` (default: 60)

Longest clip to keep, 5–180; must not be below `min_seconds`.

**title** `string`

A title for clips the scorer does not name itself.

```bash cURL theme={"system"}
curl -fsSL https://api.vetta.sh/v1/media/clips \
  -H "authorization: Bearer sk_live_..." \
  -H "idempotency-key: 6f1c...ab" \
  -H "content-type: application/json" \
  -d '{ "video_url": "https://cdn.example.com/keynote.mp4", "caption_preset": "bold", "language": "en", "max_seconds": 45 }'
```

```ts TypeScript theme={"system"}
import { createClient } from "@usenaive-sdk/managed-agents";

const client = createClient({ baseUrl: "https://api.vetta.sh", apiKey: process.env.NAIVE_API_KEY! });
const queued = await client.media.clips.create({
  video_url: "https://cdn.example.com/keynote.mp4",
  caption_preset: "bold",
  language: "en",
  max_seconds: 45,
});
const job = await client.media.clips.wait(queued.id); // polls until completed or failed
```

```bash CLI theme={"system"}
naive media clip https://cdn.example.com/keynote.mp4 --captions bold --language en --max-seconds 45 --wait
```

```json 202 Accepted theme={"system"}
{
  "id": "med_01H9HH...",
  "object": "media_job",
  "kind": "clip",
  "status": "queued",
  "model": null,
  "input": {
    "video_url": "https://cdn.example.com/keynote.mp4",
    "aspect_ratio": "9:16",
    "remove_silence": false,
    "caption_preset": "bold",
    "language": "en",
    "min_seconds": 15,
    "max_seconds": 45,
    "title": null
  },
  "result": null,
  "error": null,
  "cost_micro_usd": null,
  "session_id": null,
  "created_at": "2026-09-06T18:00:00.000Z",
  "completed_at": null
}
```

A submit is refused with `402 insufficient_credits` when the organization's prepaid balance is empty. There is no per-tenant concurrency cap on this route — your balance bounds you, not a turn — unlike the `clip_video` tool, which keeps one active job per session.

## Retrieve a job

`GET /v1/media/clips/{id}` — scope `agents:read`

```json 200 OK theme={"system"}
{
  "id": "med_01H9HH...",
  "object": "media_job",
  "kind": "clip",
  "status": "completed",
  "model": null,
  "input": { "video_url": "https://cdn.example.com/keynote.mp4", "aspect_ratio": "9:16", "remove_silence": false, "caption_preset": "bold", "language": "en", "min_seconds": 15, "max_seconds": 45, "title": null },
  "result": {
    "clips": [
      {
        "file_id": "fil_01H9HJ...",
        "title": "The one metric that changed our roadmap",
        "start_seconds": 812.4,
        "end_seconds": 851.0,
        "duration_seconds": 38.6,
        "virality": { "total": 87, "shareability": 82, "hook_strength": 91, "story_quality": 85, "emotional_impact": 90 },
        "hook": "The metric everyone tracks was the wrong one",
        "hook_text": "We were measuring the wrong thing for a year.",
        "tiktok_caption": "The one number that rewrote our roadmap #startups #product",
        "instagram_caption": "We tracked the wrong metric for a year. Here's the one that changed everything.",
        "youtube_title": "The One Metric That Changed Our Roadmap"
      }
    ]
  },
  "error": null,
  "cost_micro_usd": 291000,
  "session_id": null,
  "created_at": "2026-09-06T18:00:00.000Z",
  "completed_at": "2026-09-06T18:06:31.000Z"
}
```

```bash cURL theme={"system"}
curl -fsSL https://api.vetta.sh/v1/media/clips/med_01H9HH... -H "authorization: Bearer sk_live_..."
```

```ts TypeScript theme={"system"}
const job = await client.media.clips.wait("med_01H9HH..."); // reads every 5 s until completed or failed
if (job.status === "completed" && job.result && "clips" in job.result) {
  for (const clip of job.result.clips) console.log(clip.virality.total, clip.title, clip.file_id);
}
```

```bash CLI theme={"system"}
naive media clip show med_01H9HH... --download ./clips   # waits, then saves clip-1.mp4, clip-2.mp4, …
```

A clip's bytes are a [file](https://vetta.sh/docs/api/files.md): `GET /v1/files/{file_id}`.

## When a job fails

A failed job reads back with `status: "failed"`, `result: null`, `cost_micro_usd: null` and `error: { code, message }`. A failure is not billed. The `code` says whether trying again can help:

| `code` | Means | Retry? |
| - | - | - |
| `source_too_long` | The video is over 90 minutes. | No — use a shorter video. |
| `source_too_large` | The file is too big, or its resolution or frame rate is past what can be processed. | No — use a smaller rendition. |
| `source_unavailable` | The video is private, removed, age-restricted, members-only, or the link answered "not found". | No — fix the link. |
| `source_not_allowed` | The link is not public `https`, or points at a private address. | No — fix the link. |
| `timed_out` | The job ran out of time: a job has 60 minutes from submit, queue wait included, to finish. | Yes, once. |
| `provider_error` | Anything else, including a download refused or unavailable on our side for now. | Yes, with backoff. |

The `message` says what happened in words, for example `Video is too long (95 min, limit 90 min)`, `Video is private, age-restricted, or unavailable`, `video_url host is not allowed`, `The clip job ran out of time (60-minute limit).`, `Video exceeds the maximum allowed size` or `YouTube downloads are temporarily unavailable on our side`. Branch on `code`, not on the message. A completed job with an empty `clips` list is not a failure: it found no moment worth keeping (or no speech) and is billed what it ran.

## List jobs

`GET /v1/media/clips` — scope `agents:read`

**status** `string`

`queued`, `processing`, `completed` or `failed`.

**limit** `number`

Page size, 1–100.

**after** `string`

The `next_cursor` of the previous page.

Newest first, in the standard [list envelope](https://vetta.sh/docs/api/pagination.md). `GET /v1/media?kind=clip` answers the same list. Only jobs submitted through this API are listed; the clips an agent's `clip_video` tool cuts inside a session reach that session as [files](https://vetta.sh/docs/api/files.md), not as jobs here.

```bash cURL theme={"system"}
curl -fsSL "https://api.vetta.sh/v1/media/clips?status=completed&limit=20" -H "authorization: Bearer sk_live_..."
```

```ts TypeScript theme={"system"}
const page = await client.media.clips.list({ status: "completed", limit: 20 });
```

```bash CLI theme={"system"}
naive media clips --status completed --limit 20
```

## Webhooks

Subscribe an [endpoint](https://vetta.sh/docs/api/webhooks.md) to `media.job.queued`, `media.job.completed` (`data.file_ids` names the clips) or `media.job.failed` (`data.code`, one of the [failure codes](#when-a-job-fails), and `data.message`; sent once, whether the job failed while running or ran out of time) to be told rather than poll. Every envelope carries `data.job_id` and `data.kind: "clip"`.

## Pricing

A job is billed once, when it finishes, and `cost_micro_usd` is that figure: what the outside services it used charged us, plus one flat fee for our own servers. A failed job costs nothing. What adds up, at today's rates, in credits (5,000 credits = \$1):

| Driver | Rate |
| - | - |
| Transcription, per hour of source video | 1,100 or 200 credits, by the speech-to-text model that ran (the first is the default; the second is the fallback) |
| Scoring, per token read and written | Each video is scored three times and the picks merged, so scoring tokens are about three times one read of the transcript |
| Download bandwidth, per GB | 18,750 credits when the source had to be fetched through a rotating residential proxy (some video sites, such as YouTube when it turns our fixed addresses away); 0 credits through our fixed addresses and for a direct file |
| Server fee, per finished job | 500 credits flat. It covers cutting, captions, silence removal, `9:16` framing and storage, whatever the length, clip count or options |

A 30-minute talk from a direct file link, cut to 8 vertical captioned clips, is typically about 1,450 credits: 550 of transcription, about 400 of scoring and the 500-credit fee. From YouTube, the same talk is the same price when our fixed addresses fetch it, or about 2,350 credits when it has to go through the residential proxy (about 47 MB at 18,750 credits a GB). That is small because a YouTube source is not downloaded whole: we fetch its audio track to find the moments, then only the parts of the video the clips use, at up to 1080p. See [Pricing](https://vetta.sh/docs/platform/pricing.md#media-generation--per-finished-job-media-component).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.