# Agent Recipes

Copy-ready commands and request shapes for photo restoration, image generation, video generation, uploads, and polling.

## Fast links

- Web page: https://www.restory.pics/agent/docs/agent-recipes
- Markdown: https://www.restory.pics/api/agent/docs/markdown/agent-recipes
- Capabilities JSON: https://www.restory.pics/api/agent/capabilities
- OpenAPI JSON: https://www.restory.pics/api/agent/openapi
- API keys: https://www.restory.pics/agent

## Photo restoration

Use the CLI for local image files. Agents should submit the job, capture `imageRecordId`, and poll until completed.

```bash
restory restore --method fast --file ./old-photo.jpg
restory jobs:get <imageRecordId> --type image
```

Direct API clients can call the matching endpoint with an uploaded URL or a small data URL.

```http
POST /api/restore-photo
Authorization: Bearer rst_...
Content-Type: application/json

{
  "imageUrl": "https://restory.b-cdn.net/images/user/photo.jpg",
  "originalFileName": "old-photo.jpg"
}
```

## Image generation

Use current capability discovery before choosing model, resolution, aspect ratio, quality, or reference-image settings.

```bash
restory image:generate \
  --prompt "clean ecommerce hero image for a skincare product" \
  --model nano-banana-2 \
  --resolution 2K \
  --aspect-ratio 4:5
restory jobs:get <imageRecordId> --type image
```

```http
POST /api/generate-image
Authorization: Bearer rst_...
Content-Type: application/json

{
  "prompt": "clean ecommerce hero image for a skincare product",
  "modelSlug": "nano-banana-2",
  "resolution": "2K",
  "aspectRatio": "4:5"
}
```

## Video generation

Video generation is queued. Return the video record ID immediately, then poll for completed playback URLs.

```bash
restory video:generate \
  --prompt "slow cinematic push in, soft daylight" \
  --model seedance-2-0 \
  --image ./restored.jpg \
  --duration 8
restory jobs:get <videoRecordId> --type video
```

```http
POST /api/generate-video
Authorization: Bearer rst_...
Content-Type: application/json

{
  "prompt": "slow cinematic push in, soft daylight",
  "modelSlug": "seedance-2-0",
  "imageUrl": "https://restory.b-cdn.net/images/user/restored.jpg",
  "duration": "8"
}
```

## Upload references

Upload local references first when an endpoint needs reusable image, video, or audio URLs.

```bash
restory upload --type image --file ./reference.jpg
```

```http
POST /api/upload-reference-media
Authorization: Bearer rst_...
Content-Type: multipart/form-data

file=<binary>
type=image
```

## Poll results

Never assume generation is synchronous. Poll by type and use the returned `resultUrl` or media URL once status is completed.

```bash
restory jobs:get <imageRecordId> --type image
restory jobs:get <videoRecordId> --type video
restory gallery:list --type image --status completed --limit 10
```