> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ishushka.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ishushka.com/_mcp/server.

# Prepare and validate video settings

POST https://api.ishushka.com/v1/videos/prepare
Content-Type: application/json

Start the video workflow here: send the model and selected settings, then use the returned available options to complete the selection (resolution before aspect_ratio, and aspect_ratio before size). Repeat with the chosen values until is_complete is true. When a supported duration and resolution are supplied, estimated_price gives a preliminary customer price; it is an estimate, not the final generation charge. This endpoint does not accept a prompt or start a generation. After preparation, send the same model and settings plus your prompt to POST /v1/videos/generate. Supplied unsupported values are returned in errors with allowedValues while the response remains 200 so clients can show alternatives. No defaults are applied.

Reference: https://docs.ishushka.com/ishushka-api-actual/video/prepare-video

## Authentication

- `Authorization` header (bearer token, required) — API key passed as Authorization: Bearer token.

## Request

### Body (application/json)

This endpoint expects a VideoPrepareRequest.

- `model` (string, required) — Required video model ID from GET /v1/models?type=video.
- `duration` (integer, optional, nullable) — Optional duration in seconds. When present, it must be supported by the selected model.
- `resolution` (string, optional, nullable) — Optional model resolution. When selected, the response narrows aspect_ratios to those compatible with it.
- `aspect_ratio` (string, optional, nullable) — Optional aspect ratio. Select a compatible resolution first; the response then narrows sizes to this format.
- `size` (string, optional, nullable) — Optional size supported for the selected resolution and aspect ratio.
- `generate_audio` (boolean, optional, nullable) — Optional audio selection used when calculating an estimated price.
- `has_reference_input` (boolean, optional, nullable) — Whether the planned generation uses reference input. Used only to select a matching estimated-price SKU; this does not upload or attach a reference.

## Response

### 200

Available settings, validation state, and an optional estimated price

- `model` (string, required)
- `selection` (VideoPrepareSelection, required)
- `available` (VideoPrepareAvailableOptions, required) — Options are narrowed by the selections already provided. Aspect ratios require a valid resolution; sizes require a valid resolution and aspect ratio.
- `is_valid` (boolean, required) — Whether the supplied selections are valid so far. A partial selection can be valid but incomplete.
- `is_complete` (boolean, required) — True when duration, resolution, aspect ratio, and size are all selected and valid.
- `errors` (list of VideoValidationError, required)
- `next_step` (enum, optional, nullable)
  - Allowed values: `duration`, `resolution`, `aspect_ratio`, `size`
- `estimated_price` (VideoPrepareEstimatedPrice, optional, nullable) — Approximate customer price calculated from the current pricing configuration. Available after a supported duration and resolution are selected.
- `price_error` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Missing request body or model, or unknown video model

- `error` (VideoApiErrorError, optional)

### 402 Payment Required Error

Missing or invalid API key or inactive account

- `status` (integer, optional) — HTTP-like status code
- `error` (string, optional) — Error message

## Types

### VideoPrepareSelection

- `duration` (integer, optional, nullable)
- `resolution` (string, optional, nullable)
- `aspect_ratio` (string, optional, nullable)
- `size` (string, optional, nullable)

### VideoPrepareAvailableOptions

Options are narrowed by the selections already provided. Aspect ratios require a valid resolution; sizes require a valid resolution and aspect ratio.

- `durations` (list of integer, optional)
- `resolutions` (list of string, optional)
- `aspect_ratios` (list of string, optional)
- `sizes` (list of string, optional)

### VideoValidationError

- `code` (string, optional)
- `field` (string, optional)
- `message` (string, optional)
- `amount` (double, optional, nullable)
- `allowedValues` (list of string, optional, nullable) — Supported choices for this field, narrowed by preceding valid selections where applicable.

### VideoPrepareEstimatedPrice

Approximate customer price calculated from the current pricing configuration. Available after a supported duration and resolution are selected.

- `amount` (double, optional)
- `currency` (string, optional)
- `basis` (enum, optional)
  - Allowed values: `estimate`

### VideoApiErrorError

- `message` (string, optional)
- `type` (string, optional)
- `code` (string, optional)
- `details` (list of VideoValidationError, optional, nullable)

## Examples

**Request**

```json
{
  "model": "alibaba/happyhorse-1.0"
}
```

**Response**

```json
{
  "model": "string",
  "selection": {
    "duration": 1,
    "resolution": "string",
    "aspect_ratio": "string",
    "size": "string"
  },
  "available": {
    "durations": [
      1
    ],
    "resolutions": [
      "string"
    ],
    "aspect_ratios": [
      "string"
    ],
    "sizes": [
      "string"
    ]
  },
  "is_valid": true,
  "is_complete": true,
  "errors": [
    {
      "code": "string",
      "field": "string",
      "message": "string",
      "amount": 1.1,
      "allowedValues": [
        "string"
      ]
    }
  ],
  "next_step": "duration",
  "estimated_price": {
    "amount": 1.1,
    "currency": "USD",
    "basis": "estimate"
  },
  "price_error": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.ishushka.com/v1/videos/prepare"

payload = { "model": "alibaba/happyhorse-1.0" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.ishushka.com/v1/videos/prepare';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"model":"alibaba/happyhorse-1.0"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ishushka.com/v1/videos/prepare"

	payload := strings.NewReader("{\n  \"model\": \"alibaba/happyhorse-1.0\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.ishushka.com/v1/videos/prepare")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"model\": \"alibaba/happyhorse-1.0\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ishushka.com/v1/videos/prepare")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"model\": \"alibaba/happyhorse-1.0\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ishushka.com/v1/videos/prepare', [
  'body' => '{
  "model": "alibaba/happyhorse-1.0"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ishushka.com/v1/videos/prepare");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"model\": \"alibaba/happyhorse-1.0\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["model": "alibaba/happyhorse-1.0"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ishushka.com/v1/videos/prepare")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```