# Beatra Skill + MCP — Extend an existing video

> Continue a source clip beyond its current endpoint.
> Self-contained workflow guide for AI agents.
> Human-readable page: https://docs.beatra.ai/en/docs/capabilities/videos/video-extend

- Primary surface: the Universal Beatra Skill with authenticated MCP.
- Install or reconnect: https://beatra.ai/install.md
- MCP endpoint: `https://mcp.beatra.ai/mcp`
- Billable action: `beatra.videos.extend`
- Dynamic model facts: call `beatra.models.list` with `capability: "video_extend"` only when model constraints, controls, or prices matter.
- Interaction model: create one opaque `client_request_id`, submit the finalized arguments exactly once, then poll the returned `task_id` with `beatra.tasks.get` until terminal.
- Local media: call `beatra.assets.upload`, perform the returned HTTPS PUT exactly, and use the artifact ID from the PUT response.

REST/OpenAPI is the fallback protocol path, not the primary agent packaging.

---

## Primary agent path

Use `beatra.videos.extend` to continue beyond a clip's current endpoint. Use
edit instead when the existing timeline itself should change.

1. Upload the local source video.
2. Call `beatra.models.list` with `capability: "video_extend"` for current clip
   limits, final-duration rules, controls, and prices.
3. Describe only the continuation and any required final composition.
4. Submit once with one `client_request_id`; poll with `beatra.tasks.get`.

## Tool arguments

```json
{
  "instruction": "Continue the camera move until the train enters the tunnel",
  "video": { "type": "artifact", "artifact_id": "artifact_source_clip" },
  "direction": "after",
  "resolution": "720p",
  "duration": 12,
  "client_request_id": "vid-extend-opaque-1"
}
```

`direction` is required (`after` continues past the end). `duration` means the
final output duration, including the source clip—not the number of seconds to
add.

## Models, controls, and cost

Common controls are `prompt`, `negative_prompt`, `resolution`,
`duration`, `aspect_ratio`, `seed`, `enhance_prompt`, and `watermark`.
Use each only according to the selected model's metadata.

Use `beatra.models.list` as the current source for selectable models, accepted
source duration, final-duration range, resolution,
derived aspect ratio, defaults, and price inputs. Ensure the final duration is
valid for the source; never silently rewrite it.

## Task status and recovery

Keep polling the same task while it is `queued` or `running`. Retry a lost create
response only with identical arguments and the same `client_request_id`. A new
source, instruction, model, or duration requires a new ID.

## REST API

Direct protocol integrations use `POST /v1/videos/extend`. Follow the generated
[API operation](https://docs.beatra.ai/en/docs/api-reference/operations/videos/videos_extend_v1_videos_extend_post)
for the complete request contract. Skill + MCP is the recommended integration; REST serves custom applications.

---

## Appendix: shared Skill + MCP contract

### Retry identity

One logical generation has one `client_request_id`. If the create response is
lost, retry the exact same arguments with that ID. If any prompt, media, model,
or output control changes, use a new ID. Never create another paid task merely
because the first task is `queued` or `running`.

### Polling and billing truth

Poll with `beatra.tasks.get` using bounded backoff. Stop at `succeeded`,
`failed`, or `canceled`. Only the task response is authoritative for the
resolved model, artifacts, charged credits, and refunded credits.

### Recovery

Preserve structured Beatra error codes. Reconnect on authentication failure;
stop and request a balance action on insufficient balance; refresh current
constraints with `beatra.models.list` after model validation; request a new
upload grant after expiration or MIME/length mismatch. Changed generation
arguments always require a new `client_request_id`.
