# Model inputs

Source: https://docs.sociaro.com/jobs/inputs/

For each `POST /v2/jobs` request, select a model ID from `GET /v2/models` and construct `input` from that entry's `input_schema`. The [job envelope](https://docs.sociaro.com/jobs/#submit) is shared. The schema defines the prompt format and media fields for the selected model.

The sections below are **model-specific examples**. For the current field list, allowed values and required inputs, use the [catalogue](https://docs.sociaro.com/models/index.md) or the schema returned by discovery. See [input validation](https://docs.sociaro.com/jobs/inputs/#how-input-is-checked) for the shared rules.

## Alibaba

Example text-to-video input for `alibaba/wan-3-video`:

```json
{"model": "alibaba/wan-3-video", "input": {"prompt": "a paper boat drifting down a rain-soaked street"}}
```

For a different task, [Wan 2.7 Image](https://docs.sociaro.com/models/alibaba-wan-2-7-image/index.md) uses image-specific parameters. Its `color_palette` takes 3–10 `{hex, ratio}` entries with ratios totalling 100. Its schema does not accept `negative_prompt`.

## ByteDance Seedream 5.5

`bytedance/seedream-5-5` makes an image from a prompt or edits up to ten reference images supplied as public HTTPS
URLs in `input.image`. To decompose a design, submit one source image to `POST /v2/jobs` with your usual
`Authorization`, `Content-Type: application/json` and `Idempotency-Key` headers.

```json
{
  "model": "bytedance/seedream-5-5",
  "input": {
    "image": "https://your-cdn.example.com/poster.png",
    "layer_decomposition": true,
    "layer_decomposition_options": {"max_images": 8, "text_recognition": true}
  }
}
```

Decomposition accepts one PNG or JPEG. A prompt is optional. `max_images` includes the base and can range from 2 to
100, with a default of 30. Leave the Jobs envelope's `output.count` at 1 for one composition: the job returns up to `max_images` outputs, the base
first. Each image returned (including the base) is billed at its own pixel tier, and the source image is billed once. A
layer the provider could not produce is left out and not billed; the others are delivered.

Poll `GET /v2/jobs/{id}` until the job succeeds. Download the base from `outputs[0].url`. Each subsequent output has
its own `url` and a `layer` object. Place each layer at its `bounding_box.absolute` coordinates in base-image pixels,
in ascending `z_index`. With text recognition enabled, regular-text layers can include
`layer.text_recognition.text`, individual lines with bounding boxes, and styled runs of text.

## ByteDance Seedance

**ByteDance Seedance models** (`bytedance/seedance-*`) take the vendor's `content` array, the same
shape as on `/v1`:

```json
{"model": "bytedance/seedance-2.0",
 "input": {"content": [{"type": "text", "text": "a paper boat drifting down a rain-soaked street"}],
           "resolution": "480p", "duration": 4, "generate_audio": false}}
```

Seedance also takes the generator's `execution_expires_after` (seconds, 3600–259200) and `safety_identifier` (a
fixed id for your end user, 1–64 characters). Both are checked at submit: a value outside those is a
`400 invalid_input` and no job. For `safety_identifier` we send a per-organisation pseudonym of your value, never the
value itself, and the job stores only the pseudonym. The job itself still ends at its own `max_runtime_sec`.

Seedance's `input` is closed. At submit a `400 invalid_input` and no job follow from: a field the model's
`input_schema` does not name (`service_tier`, `priority`, `callback_url`, `model` and `tools` among them), a value
outside an enum or range, and a `content` part that is wrongly shaped (an unknown `type`, a `role` the type does not
take, an extra key, a url that is not a non-blank string). The part counts and the first-frame, last-frame and
reference rules are checked there too.

`return_last_frame: true` also returns the clip's closing still, as an extra output after the clip
(`type` `image`). It is not counted in `output.count`, adds no charge, and is optional: if it cannot be
delivered, the clip is still delivered without it.

Seedance's own rules for `frames`, `camera_fixed` and `draft` are under [How input is checked](https://docs.sociaro.com/jobs/inputs/#how-input-is-checked).

### Edit or extend a clip

Editing or extending a clip on `bytedance/seedance-2.0`, `bytedance/seedance-2.0-fast` and
`bytedance/seedance-2.0-mini` is the same shape, with no field or role of its own: put the clip in `content` as a
`reference_video` part and say in the prompt what to do with it, naming it `[Video 1]`. Two or three clips are joined with generated transitions. The model page has the
details, and the job is billed like any Seedance job with a video input:

```json
{"model": "bytedance/seedance-2.0",
 "input": {"content": [{"type": "text", "text": "Replace the cat in [Video 1] with the lion from [Image 1]"},
                       {"type": "image_url", "image_url": {"url": "https://your-cdn.example.com/lion.jpg"},
                        "role": "reference_image"},
                       {"type": "video_url", "video_url": {"url": "https://your-cdn.example.com/cat.mp4"},
                        "role": "reference_video"}],
           "resolution": "720p", "ratio": "16:9", "duration": 5}}
```

### Draft mode (Seedance 2.5)

`bytedance/seedance-2.5` supports a 480p draft followed by a separate final render. For the draft, send `"draft": true` in `input`:

```json
{"model": "bytedance/seedance-2.5",
 "input": {"content": [{"type": "text", "text": "a paper boat drifting down a rain-soaked street"}],
           "duration": 4, "draft": true}}
```

After the draft succeeds, submit its Sociaro `job_…` ID in a `draft_task` part. Use a new `Idempotency-Key` for the final render:

```json
{"model": "bytedance/seedance-2.5",
 "input": {"content": [{"type": "draft_task",
                        "draft_task": {"id": "job_5cc8778b79574aaa7ea8fc09caec23e5"}}]}}
```

- **Send no `resolution`** unless you want the final at 4K. `/v2` sets it on both steps, `480p` on the draft and
  `1080p` on the final; send `"resolution": "4k"` on the final for 4K. Any other value is a `400`. (On `/v1` a final
  does have to carry `"resolution": "1080p"` or `"4k"`, because there your body goes to the generator as written.
  Here we build it, so you need not.)
- The final reuses the draft's prompt, references, duration, ratio, seed and audio settings. You do not
  resend them.
- The two jobs are billed separately, each as an ordinary video at its own resolution. The final's token
  rate is the one the **draft's** inputs earn, so a final whose draft had an input video is charged the
  with-video rate, although the final's own body has no video.
- The draft has to be one of your own jobs, a draft, and `succeeded`. A job of someone else's gets the
  same answer as an id that does not exist. Past the generator's own seven days a final built from it fails.

## Kling

Example using a `prompt` and nested `settings`. Other Kling video modes use typed `contents` parts for input media.

```json
{"model": "kling/kling-2.6-t2v",
 "input": {"prompt": "a paper boat drifting down a rain-soaked street",
           "settings": {"resolution": "720p", "duration": 5}}}
```

### Refused at submit

Their `input_schema` is closed, like every model's, and each of the following is a `400 invalid_input` at submit:

- a field the schema does not name (inside a `contents` part too: each part kind takes only the keys the schema lists for it)
- `options.callback_url` (use the envelope's `callback_url`)
- `options.external_task_id`
- `options.watermark_info.enabled: true`
- a `contents` part of type `element` except on `kling/kling-4.0-omni` and `kling/kling-4.0-flash-omni`, type `voice` except on `kling/kling-4.0-omni`
- on `kling/kling-3.0-omni` a reference video (a `contents` part of type `feature_video` or `base_video`, or `settings.audio: "original"`)
- on 2.6 native audio or a last frame at `720p`
- on 4.0 and 4.0 Flash a missing `settings.duration` or more than 10 images
- on Omni more than 5 input videos, two `base_video`s, a video not given as a public https URL, or more than 7 elements or 3 voices
- on 4.0 Flash `1080p` or a `middle_frame` or `last_frame` part

### Elements, voices, failures and price

On `kling/kling-4.0-omni` and `kling/kling-4.0-flash-omni`
an `element_id` (or, on 4.0 Omni, a `voice_id`) that is not your organisation's own (made on `/v1/kling/elements` or `/v1/kling/voices`,
see the [Generations API](https://docs.sociaro.com/generations-api/index.md)) or one of Kling's presets is a `404 not_found`, and no job; a moment
when the gateway cannot read Kling's preset list is a `503 unavailable`, to retry.
`prompt_enhance` is not offered on them. Their failures read like every `/v2` job's
(`provider_rejected`, `provider_failed`), with Kling's own reason in `message`, and on a refusal at submit its code in `provider_code`. The price is the `/v1` price ([Generations API](https://docs.sociaro.com/generations-api/index.md)), charged once, on completion.

### Kling 4.0 and 4.0 Flash

Kling 4.0 and 4.0 Flash require `settings.duration`. For [Kling 4.0 Omni](https://docs.sociaro.com/models/kling-kling-4-0-omni/index.md), `feature_video` and `base_video` accept public HTTPS links. Source duration must be readable, 3–30 seconds per clip and 30 seconds at most in total. A request outside these limits returns `400 invalid_input`.

[Kling 4.0 Flash Omni](https://docs.sociaro.com/models/kling-kling-4-0-flash-omni/index.md) accepts `720p`, a duration of 3–20 seconds and up to 20 seconds of input video combined. It supports elements. Voice inputs are unavailable.

### Kling Image 4.0

[Kling Image 4.0](https://docs.sociaro.com/models/kling-kling-4-0-image/index.md) takes `contents`, `settings` and `options`. Set `settings.result_type` to `single` (1–9 images) or `series` (2–10 images). Set the number with `output.count`. `settings.n`, `settings.series_amount` and an automatic count are rejected. Results are billed per delivered image.

## MiniMax H3

For [MiniMax H3](https://docs.sociaro.com/models/minimax-h3/index.md), use a `content` array with text and optional media parts. Set `resolution` and `duration`. Text-only requests also require a concrete aspect ratio. Example using a first frame:

```json
{"model": "minimax/h3",
 "input": {"content": [{"type": "text", "text": "The paper boat drifts down the rain-soaked street."},
                       {"type": "image_url", "image_url": {"url": "https://your-cdn.example.com/first.png"},
                        "role": "first_frame"}],
           "resolution": "768P", "duration": 10}}
```

Use the exact resolution enum for the selected variant. For example, H3 accepts `768P` and `2K`, while H3 Max accepts `480P` and `768P`. Media can be a public HTTPS URL or a supported data URI. Frames cannot be mixed with reference images, clips or audio. See the model's page for durations, media counts and billing units.

### Regenerate at 2K

`minimax/h3-regeneration` renders one of your own `minimax/h3` jobs again at
`2K`, at its own length and with its own sound. Name that job by its id (ours, `job_...`) in `source_job`; nothing
else needs sending, since the prompt, pictures and clips are the original job's:

```json
{"model": "minimax/h3-regeneration",
 "input": {"source_job": "job_0123456789abcdef0123456789abcdef"}}
```

The original must be a job of yours that `succeeded` at `768P` and was submitted less than 24 hours earlier. Any other
source is a `400 invalid_input` at submit and no job; someone else's job gets the same answer as an id that does not exist.
Its schema is closed too, and narrower: `source_job`, an optional `aigc_watermark` (`true` or `false`) and a
`resolution` of `2K` (the only one, so it need not be sent) are all it takes, and anything else, MiniMax's own
`source_task_id` included, is a `400 invalid_input`. The original job is left as it was. The new one is billed once,
on completion, from what the generator reports: seconds of 2K output, plus the original job's reference clips and
pictures past the first five, which the generator bills again. The [model's page](https://docs.sociaro.com/models/minimax-h3-regeneration/index.md)
has the rates.

## Pruna

[Pruna P-Video](https://docs.sociaro.com/models/pruna-p-video/index.md) takes `prompt`, `duration` and `resolution` directly in `input`. Related models have separate schemas for avatars, editing and upscaling.

```json
{"model": "pruna/p-video",
 "input": {"prompt": "a paper boat drifting down a rainy street", "duration": 5, "resolution": "720p"}}
```

A job makes one output (`output.count` is at most 1), and it is `outputs[0].url`, a link on `cdn.sociaro.com` kept for at least ten years (`expires_at`).
`pruna/p-video-2-pro-reference`, `pruna/p-video-2-pro-avatar`, `pruna/p-video-upscale`, `pruna/p-video-2-pro-replace`
and `pruna/p-video-2-pro-lipsync` are billed on the finished video, exactly as on `/v1`, once, on completion; the other three are priced from the request.
`pruna/p-video-2-pro-reference` reads the length of each reference video and audio file from its own header when you
submit, so a file whose length cannot be read is a `400 invalid_input` and no job is created.
`pruna/p-video-2-pro-replace` is the long one: its `max_runtime_sec` is 10800 (3 hours), where every other Pruna id has
the default (video 30 minutes, image 5). The results of `pruna/p-video-2-pro-replace` and `pruna/p-video-upscale` can be up
to 2 GiB. While a large result is being stored, one `GET /v2/jobs/{id}` can take long or time out; poll again.

## How input is checked

Validate `input` using the selected model's `input_schema` (JSON Schema draft 2020-12, as used by OpenAPI 3.1). Compatible validators include Ajv's `Ajv2020` and Python's `Draft202012Validator`.

Unknown fields, invalid types, unsupported enum values and incorrectly shaped parts return `400 invalid_input` with `job_created: false`. Validation occurs before job creation. The error message identifies the field.

- A whole-number field must be a JSON integer: send `5`, not `5.0`. A 2020-12 validator accepts `5.0`; the API
  does not, and refuses it at submit. The same holds for the `element_id` and `voice_id` of a Kling part: send `7`,
  not `7.0` or `7e0`.
- An optional top-level field sent as `null` counts as not sent.
- On Seedance, `frames` and `camera_fixed` are not in the schema, because the generator refuses them on every
  Seedance model: they are refused at submit when they carry a value (anything but `null`, `false`, `0` or an empty
  string), with `400` `invalid_input` and `frames is not supported by this model` (or `camera_fixed ...`). On the 2.0
  models `omni_reference_task_type` is listed as deprecated: it is accepted and has no effect there. `draft` is listed
  as deprecated on the 2.0 models and `bytedance/seedance-2.5-flash`, because only `bytedance/seedance-2.5` has draft
  mode. On the 2.0 models and `bytedance/seedance-2.5-flash`, `draft: true` is refused at submit with `400`
  `invalid_input`, and `draft: false` passes the check and is sent to the generator as given, so leave the field out
  on those models.

Validation of media content can continue after submission. Examples of provider-side checks and model-specific submit checks include:

- content moderation and the check for real people in input media
- an input file the generator cannot fetch or decode (size, dimensions, codec, frame rate)
- the length of an input clip or sound, except where it is read from the file's own header when you submit: on
  `kling/kling-4.0-omni` and `kling/kling-4.0-flash-omni` (input videos) and `pruna/p-video-2-pro-reference`
  (reference videos and sounds) a length that cannot be read is a `400 invalid_input`, and so is a Kling video
  outside the model's range (see above); on Leda Pro a reference video or sound outside 2–15 s, or more than 15 s
  of either kind together, is a `400 invalid_input`, with 0.15 s of tolerance per clip, and a length that cannot be
  read is left to the generator, except a reference video's on a request near Leda Pro's sequence limit, which is a
  `400` too
- an expired draft
- on Seedance a task type that does not fit the inputs when the type is left automatic, and old-style flags written inside the prompt text
- on MiniMax a second text part and a `last_frame` sent without a `first_frame`
- on Alibaba `enable_thinking` with `prompt_extend` off and some combinations of `wan-3` references
- a generator outage or timeout

For Seedance, text across all `content` parts is limited to 100,000 characters. Both submit and estimate return `400 invalid_input` for a longer prompt. See [failed jobs](https://docs.sociaro.com/jobs/failures/#failed-jobs) for terminal failures.
