# Svd

> Svd API endpoint


## Overview

- **Endpoint**: `https://fal.run/fal-ai/svd`
- **Model ID**: `fal-ai/svd`
- **Category**: unknown
- **Kind**: inference


## Pricing

- **Price**: $0 per compute seconds

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`image_url`** (`string`, _required_):
  The URL of the image to use as a starting point for the generation.
  - Examples: "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png", "https://storage.googleapis.com/falserverless/model_tests/svd/mustang.png", "https://storage.googleapis.com/falserverless/model_tests/svd/ship.png", "https://storage.googleapis.com/falserverless/model_tests/svd/rocket2.png"

- **`mask_image_url`** (`string`, _optional_):
  The URL of the image to use as a mask for the generation. The mask should be
  a black and white image, where black represents the area that will be
  will move, and white represents the area that will stay still.

- **`control_maps_data_url`** (`string`, _optional_):
  A sequence of depths maps as a archive file url. A depth map is need for every frame.
  The frame count for the video will equal the number of depth map frames in the archive.
  The images will be sorted by file name. Acceptable image extensions are: '.jpg', '.jpeg',
  '.png', '.bmp', '.gif', or '.tiff'. All other files will be ignored.

- **`motion_bucket_id`** (`integer`, _optional_):
  The motion bucket id determines the motion of the generated video. The
  higher the number, the more motion there will be. Default value: `127`
  - Default: `127`
  - Range: `1` to `255`

- **`cond_aug`** (`float`, _optional_):
  The conditoning augmentation determines the amount of noise that will be
  added to the conditioning frame. The higher the number, the more noise
  there will be, and the less the video will look like the initial image.
  Increase it for more motion. Default value: `0.02`
  - Default: `0.02`
  - Range: `0` to `10`

- **`seed`** (`integer`, _optional_):
  The same seed and the same prompt given to the same version of Stable Diffusion
  will output the same image every time.

- **`steps`** (`integer`, _optional_):
  The number of steps to run the model for. The higher the number the better
  the quality and longer it will take to generate. Default value: `20`
  - Default: `20`
  - Range: `1` to `100`



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png",
  "motion_bucket_id": 127,
  "cond_aug": 0.02,
  "steps": 20
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`File`, _required_):
  The generated video file.

- **`seed`** (`integer`, _required_):
  Seed of the generated Image. It will be the same value of the one passed in the
  input or the randomly generated that was used in case none was passed.



**Example Response**:

```json
{
  "image": {
    "url": "https://url.to/generated/file/z9RV14K95DvU.png",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/svd \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/svd",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/svd", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/model_tests/svd/rocket.png"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/svd)
- [API Documentation](https://fal.ai/models/fal-ai/svd/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/svd)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
