# Kling 4.0 API: access, pricing and code

> Is there a Kling 4.0 API? Get the official Kling 4.0 API on Runway Dev, self-serve: model ID, price per second, inputs and code in curl, Node and Python.

Author: Runway · Published: 2026-10-26 · Updated: 2026-10-26 · Source: https://dev.runway.com/learn/kling-4-0-api

## Summary

There is a Kling 4.0 API, and Runway Dev gives you the official Kling 4.0 API from Kling, self-serve with an API key. Kling 4.0 is Kling's video model for generating and editing in one model: it makes clips with sound from a prompt, from first, middle and last frames or from reference images and videos, and it edits a video you already have, at 720p or 1080p. This page covers access, pricing, inputs and code, and how your coding agent can build the integration for you.

## What is Kling 4.0?

Kling 4.0 is Kling's video generation model for clips of up to 30 seconds with sound, made in one pass. It does in one model what [Kling 3.0](https://dev.runway.com/learn/kling-3-0-api) and [Kling O3](https://dev.runway.com/learn/kling-o3-api) split between two: text-to-video, image-to-video from a first frame with middle and last frames if you want them, generation guided by reference images and reference videos and the editing of a clip you already have.

Kling 4.0 renders at 720p or 1080p, in landscape, portrait, square or a wide 21:9 frame, or in a shape it picks from your inputs.

## What are the ways to use Kling 4.0 on Runway Dev?

Kling 4.0 runs on Runway Dev four ways, all from one account:

| Way in                                                                                                                 | Best for                                                                                          | What you need                                                   |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| [Playground](https://dev.runway.com/endpoints/text_to_video?modelId=kling_4)                                           | Trying a prompt, then copying the request as code                                                 | A Runway Dev account                                            |
| [API](https://docs.dev.runwayml.com/guides/using-the-api/) and [SDKs](https://docs.dev.runwayml.com/api-details/sdks/) | Calling Kling 4.0 from your own code                                                              | An API key, plus the Node or Python SDK if you want one         |
| Coding agent                                                                                                           | Having Claude Code, Codex or Cursor build the API integration into your product, tool or pipeline | The Runway Dev MCP and skills, and an API key for live calls    |
| [Workflows](https://dev.runway.com/workflows)                                                                                                | Kling 4.0 as one step with other models, run with one API call                                    | A workflow built in the Runway app and published as an endpoint |

Kling 4.0 is also available in [Model Router](https://dev.runway.com/model-routers), a saved config you send with the request instead of a model ID. You set what to optimize for (cost, quality or latency), a maximum cost per generation and the models allowed, and the router picks one for each request sent to `POST /v1/generate/video`.

## How do you get API access to Kling 4.0?

You get API access to Kling 4.0 with a Runway Dev account and an API key:

1. Create an account at https://dev.runway.com.
2. Create an API key in your project's dashboard.
3. Add credits to your project's balance.
4. Store the key in your environment as `RUNWAYML_API_SECRET`.
5. Send a request with `"model": "kling_4"` and the `X-Runway-Version` header to one of its endpoints. The code below is ready to run.

## How much does the Kling 4.0 API cost?

The Kling 4.0 API on Runway Dev is billed per second, at a rate set by the resolution: 23.5 credits ($0.235) per second at 1080p, with a lower rate at 720p. A request that sends a video, to edit it or as a reference, is billed at the input-video rate for more seconds, as the table shows.

| Resolution | Credits | USD |
| --- | --- | --- |
| 720p | 15.7 credits per second | $0.157 per second |
| 1080p | 23.5 credits per second | $0.235 per second |

- With an input video, 9.4 credits ($0.094) per second at 720p, 14.1 ($0.141) at 1080p.
- Billed seconds are the output plus the longer of the input and the output.

Prices current as of October 26, 2026. 1 credit = $0.01.

How the billing works:

- **Output seconds are billed at the resolution's rate.** Input images add nothing to the price.
- **A video in the request moves it to the input-video rate.** The billed seconds are then the output plus the longer of the input video and the output, and an edit's output runs as long as the clip you send.
- **`ratio` sets the resolution, and so the rate.** On image-to-video and video-to-video, `auto_1080p` is billed at the 1080p rate, and leaving `ratio` out renders and bills at 720p.
- **A request rejected with a 400 costs nothing.** Fields and values are checked before a task is created, so a wrong one isn't billed.
- **A task that fails input moderation (`SAFETY.INPUT.*`) is still charged.** See [task failures](https://docs.dev.runwayml.com/errors/task-failures) for what each failure means.

Every rate is also listed on [dev.runway.com/pricing](https://dev.runway.com/pricing) and in the [docs pricing guide](https://docs.dev.runwayml.com/guides/pricing/).

## What inputs does Kling 4.0 accept?

Kling 4.0 accepts a prompt of up to 26,000 characters in English (fewer in other scripts, which share the budget), a duration of 3 to 30 seconds and up to 10 images in all, frames and reference images together. Each endpoint uses them differently.

On `POST /v1/text_to_video` you send a `promptText` and a `ratio`, which sets both the shape and the resolution: an output size in pixels at 720p or 1080p, or `auto_720p` and `auto_1080p` to let the model frame the clip. Add `references` to bring a character, an object or a style in from images, and `referenceVideos` to guide the style, motion or camera work from clips you already have.

On `POST /v1/image_to_video` you set the frames. A single `promptImage` URL is the first frame. For more control, send a list with one image whose `position` is `first`, up to 8 whose `position` is `middle`, played in the order of the list, and an optional `last`. The clip takes the shape of the first frame, so `ratio` here only picks the resolution, and the prompt is optional unless you also send references.

On `POST /v1/video_to_video` you send the clip to edit as `videoUri` and say what to change in `promptText`. The edit keeps the source's length and framing, so it takes no `duration`, and `ratio` again picks only the resolution. Add `references` to bring a character, object or style into the edit from images.

Here is every field, by endpoint:

### `POST /v1/image_to_video`

| Field | Accepts |
| --- | --- |
| `model` (required) | `kling_4` |
| `promptImage` (required) | One image, or a list of up to 10 images, each with a `position` of `first`, `middle` or `last` (a `middle` or `last` frame needs a `first` one) |
| `ratio` | One of `auto_720p` or `auto_1080p` |
| `promptText` | Text, 1 to 26,000 characters |
| `duration` | Whole number from 3 to 30 |
| `references` | A list of up to 10 images |
| `referenceVideos` | A list of up to 5 videos |

### `POST /v1/text_to_video`

| Field | Accepts |
| --- | --- |
| `model` (required) | `kling_4` |
| `promptText` (required) | Text, 1 to 26,000 characters |
| `ratio` | One of `1280:720`, `720:1280`, `940:940`, `1460:624`, `1920:1080`, `1080:1920`, `1440:1440`, `2200:940`, `auto_720p` or `auto_1080p` |
| `duration` | Whole number from 3 to 30 |
| `references` | A list of up to 10 images |
| `referenceVideos` | A list of up to 5 videos |

### `POST /v1/video_to_video`

| Field | Accepts |
| --- | --- |
| `model` (required) | `kling_4` |
| `videoUri` (required) | One video |
| `promptText` (required) | Text, 1 to 26,000 characters |
| `ratio` | One of `auto_720p` or `auto_1080p` |
| `references` | A list of up to 10 images |

Images and videos go in as an HTTPS URL, a `runway://` URI from an [upload](https://docs.dev.runwayml.com/assets/uploads) or a data URI; [inputs](https://docs.dev.runwayml.com/assets/inputs) lists sizes and formats. Each table shows what a field accepts on its own. Rules that combine fields are checked when the task is submitted, and the [API reference](https://docs.dev.runwayml.com/api/) has them in full.

A few rules change what you send:

- **`ratio` takes different values per endpoint.** Text-to-video takes output sizes in pixels or the two `auto` values; image-to-video and video-to-video take only `auto_720p` or `auto_1080p`, and a size in pixels there returns a 400.
- **References need a prompt.** A request with `references` or `referenceVideos` and no `promptText` returns a 400.
- **Reference videos have a length window.** Each one runs at least 3 seconds, and up to 5 of them run at most 30 seconds together.
- **Images and videos have an aspect-ratio range**, checked when you submit. See [inputs](https://docs.dev.runwayml.com/assets/inputs) for formats and file sizes.
- **Unknown fields return a 400.** The request schema is strict, so a field name from another API, such as `aspect_ratio`, is rejected rather than ignored.

## How do you call Kling 4.0 from curl, Node and Python?

You call Kling 4.0 by sending `kling_4` as the model to one of its endpoints. This request makes a clip with sound from text with `POST /v1/text_to_video`, and the other fields keep their defaults:

**curl**

```bash
curl -X POST https://api.dev.runwayml.com/v1/text_to_video \
  -H "Authorization: Bearer $RUNWAYML_API_SECRET" \
  -H "X-Runway-Version: 2024-11-06" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kling_4",
    "promptText": "Locked-off wide shot of a red hot-air balloon lifting off a dewy field at dawn: the burner flares orange and the balloon rises slowly over a line of poplar trees into a pale pink sky. Audio: the roar of the burner in short bursts, a light breeze and birds waking up."
  }'

# The response carries the task id. Poll the task until it finishes:
curl https://api.dev.runwayml.com/v1/tasks/$TASK_ID \
  -H "Authorization: Bearer $RUNWAYML_API_SECRET" \
  -H "X-Runway-Version: 2024-11-06"
```

**Node.js**

```javascript
import RunwayML, { TaskFailedError } from '@runwayml/sdk';

// Reads your API key from RUNWAYML_API_SECRET.
const client = new RunwayML();

try {
  const task = await client.textToVideo
    .create({
      model: 'kling_4',
      promptText: 'Locked-off wide shot of a red hot-air balloon lifting off a dewy field at dawn: the burner flares orange and the balloon rises slowly over a line of poplar trees into a pale pink sky. Audio: the roar of the burner in short bursts, a light breeze and birds waking up.',
    })
    .waitForTaskOutput();
  console.log(task.output);
} catch (error) {
  if (error instanceof TaskFailedError) {
    console.error(error.taskDetails);
  } else {
    throw error;
  }
}
```

**Python**

```python
from runwayml import RunwayML, TaskFailedError

# Reads your API key from RUNWAYML_API_SECRET.
client = RunwayML()

try:
    task = client.text_to_video.create(
        model="kling_4",
        prompt_text="Locked-off wide shot of a red hot-air balloon lifting off a dewy field at dawn: the burner flares orange and the balloon rises slowly over a line of poplar trees into a pale pink sky. Audio: the roar of the burner in short bursts, a light breeze and birds waking up.",
    ).wait_for_task_output()
    print(task.output)
except TaskFailedError as error:
    print(error.task_details)
```

Generation is asynchronous:

- **The create request returns a task ID right away**, and the video is made in the background.
- **Poll `GET /v1/tasks/{id}` with backoff** until the status is `SUCCEEDED`, `FAILED` or `CANCELLED`. `THROTTLED` means the task is waiting in a queue, not rejected.
- **Output URLs are temporary**, so download the video when the task succeeds. See [outputs](https://docs.dev.runwayml.com/assets/outputs).
- **The SDKs poll for you.** `waitForTaskOutput()` and `wait_for_task_output()` raise `TaskFailedError` with the task's details when it fails. They also stop waiting after a default timeout while the task keeps running, so for long clips pass a longer timeout or keep polling the task ID.
- **To use your own rules instead of one fixed model**, send a [Model Router](https://dev.runway.com/learn/choosing-the-right-model)'s `configId` to `POST /v1/generate/video` in place of the model. Add `dryRun` to see which model it picks without creating a task.

## Why does a Kling 4.0 API request fail?

A request to Kling 4.0 fails with a 400 when a field is wrong, and a task fails with a failure code that names the cause. The common ones:

- **A 400 on `ratio`**: a size in pixels sent to image-to-video or video-to-video, or a value from another model. Use `auto_720p` or `auto_1080p` there.
- **A 400 asking for `promptText`**: the request has `references` or `referenceVideos` and no prompt. Add one.
- **A 400 on `promptImage`**: a list needs exactly one `first` frame, at most one `last` and at most 8 `middle` frames.
- **A 400 on the number of images**: frames and `references` together go past 10 images. Drop some references.
- **A reference video rejected for its length**: each one has to run at least 3 seconds, and all of them together at most 30 seconds.
- **`SAFETY.INPUT.*`**: content moderation rejected an input. The task is charged and shouldn't be retried as is: change the inputs first.
- **`INTERNAL.BAD_OUTPUT.01`**: the output failed a quality check, often because of logos, watermarks or text in an input image. Remove them and retry.
- **`ASSET.INVALID`**: an input's dimensions, length or format are outside what the model takes. Check it against [inputs](https://docs.dev.runwayml.com/assets/inputs) and fix it before retrying.
- **`THIRD_PARTY.UNAVAILABLE`**: the model's provider didn't return the video, because of an outage or load. Wait, then retry.
- **A bill higher than you expected**: a video in the request moves it to the input-video rate and adds the input's seconds. Check the request for `videoUri` or `referenceVideos`.

## What does Runway Dev add when you call Kling 4.0?

Runway Dev serves Kling 4.0 next to [Runway's own models and other labs' models](https://dev.runway.com/models/catalog), behind one API key and one credit balance: you build with a single key and pay a single bill, instead of an account, a key and an invoice per lab.

A coding agent can do the Kling 4.0 integration for you on Runway Dev, end to end. Connect the [Runway Dev MCP](https://docs.dev.runwayml.com/guides/mcp/) and the agent works from your live account: the models your project can call with their current prices and input limits, your credit balance and the record behind any task. It writes the integration against what the API accepts today, and when a task fails it looks up the reason and fixes it. The [Runway Dev skills](https://github.com/runwayml/skills) show the agent how to integrate with the official SDKs and how to build with models, Model Routers, Recipes and Workflows.

With [Workflows](https://dev.runway.com/workflows), Kling 4.0 becomes one step of a larger pipeline: chain it with [Runway's own models and other labs' models](https://dev.runway.com/models/catalog), for images, video and audio, and run the whole pipeline with a single API call. Workflows don't need to be built by a developer. A creative or marketing teammate builds and tests one visually in the [Runway app](https://app.runwayml.com/workflows) ([how Workflows work](https://help.runwayml.com/hc/en-us/articles/45763528999699-Introduction-to-Workflows)), then [publishes it as an endpoint](https://help.runwayml.com/hc/en-us/articles/50682960972947-Publishing-a-Workflow-as-an-Endpoint) that your code calls. When the team updates the workflow, your code keeps calling the same endpoint.

## FAQ

**Is there a Kling 4.0 API?**

There is a Kling 4.0 API, and Runway Dev serves the official Kling 4.0 model from Kling, self-serve: create an account, make an API key and send `kling_4` as the model to any of `POST /v1/image_to_video`, `POST /v1/text_to_video` and `POST /v1/video_to_video`. It runs on the same key, SDKs and credit balance as every other model on Runway Dev.

**Is there a Kling API?**

There is a Kling API, from two places. Kling sells API access on its own [developer platform](https://kling.ai/dev), which listed Kling 4.0 as early access when we checked on October 26, 2026. Runway Dev serves the official Kling models through its API: Kling 4.0, [Kling 3.0](https://dev.runway.com/learn/kling-3-0-api) in three tiers, [Kling O3](https://dev.runway.com/learn/kling-o3-api) and Kling 2.5 Turbo Pro, all with one key and one credit balance.

**Do I need a Kling account to use the Kling 4.0 API?**

You don't need a Kling account to use the Kling 4.0 API on Runway Dev: a Runway Dev account and API key are all you need, and Kling 4.0 is paid from the same credit balance as every other model. To have a coding agent write the integration, connect the Runway Dev MCP and install the Runway Dev skills: the agent builds it from your live account, with the prices and input limits your project has today.

**What does Kling 4.0 cost per second at 720p and 1080p?**

On Runway Dev, Kling 4.0 costs 23.5 credits ($0.235) per second at 1080p and 15.7 credits ($0.157) per second at 720p. A request that sends a video, to edit it or as a reference, is billed at the input-video rate for its output plus the longer of the input and the output. Input images add no charge. Prices are current as of October 26, 2026.

**Is the Kling 4.0 API on Runway Dev the official model?**

Runway Dev's Kling 4.0 API runs the official Kling 4.0 model from Kling. You call it with your Runway Dev API key and the model ID `kling_4`, like every other model on Runway Dev.

**Which Kling models can I use through the Runway Dev API?**

Runway Dev serves four Kling models through one API. Kling 4.0 (`kling_4`) generates and edits in one model. [Kling 3.0](https://dev.runway.com/learn/kling-3-0-api) (`kling3.0_pro`, `kling3.0_standard`, `kling3.0_4k`) generates multi-shot clips, up to 4K. [Kling O3](https://dev.runway.com/learn/kling-o3-api) (`klingO3_pro`, `klingO3_4k`, `klingO3_standard`) edits video and generates from references. Kling 2.5 Turbo Pro (`kling2.5_turbo_pro`) is an earlier model.

**What is the difference between Kling 4.0 and Kling 3.0?**

Kling 4.0 generates and edits in one model: it takes text, frames, reference images and reference videos, and it edits clips you send. Kling 3.0 generates from text or from a first and last frame and makes multi-shot clips, with a 4K tier and a lower rate without audio, and leaves references and editing to Kling O3. Kling 4.0 renders at 720p or 1080p.

**Can I use Kling 4.0 without writing code?**

You can use Kling 4.0 on Runway Dev without writing code yourself. The playground sends a request from a form and gives it back as code, and a coding agent connected to the Runway Dev MCP writes the integration for you. A creative or marketing teammate can also build a workflow around Kling 4.0 in the Runway app and publish it as an endpoint your app calls.

**Does the same Runway Dev API key work for Kling 4.0 and other models?**

One Runway Dev API key calls Kling 4.0 and every other model your project can use, Runway's own and other labs', with the same SDKs, task flow and credit balance. Switching models means changing the `model` field, or the rules of a Model Router.

**Does Kling 4.0 generate audio through the API?**

Kling 4.0 generates sound with the picture, in the same pass: the sound effects and ambient sound of the scene you describe. There is no field to turn it off, and the rate is the same either way.

**Can Kling 4.0 edit a video through the API?**

Kling 4.0 edits a video through `POST /v1/video_to_video`: send the clip as `videoUri` and what to change in `promptText`, with `references` if the edit brings in a character, object or style. The edit keeps the source's length and framing, and it is billed at the input-video rate.

**Why did my Kling 4.0 request fail with `SAFETY.INPUT.TEXT`?**

`SAFETY.INPUT.TEXT` means content moderation rejected an input of your request; the suffix hints at the prompt but may not match. The task is charged and shouldn't be retried as is, so change the prompt or inputs before you send it again.

**Can I switch from Kling 4.0 to another video model without changing my code?**

A Model Router lets you change models without touching your code. Send its `configId` to `POST /v1/generate/video`, and change the models it may use, its priority or its cost cap in the router.
