A complete walkthrough of Kling video generation through one API: choosing a Kling model, writing the request, polling the job, downloading the clip, and what it costs.
Kling is Kuaishou's family of video generation models. Through ScalingTensor you can call every Kling model in the catalog with one API key and one prepaid wallet, without a separate Kling account. This guide goes from an empty project to a downloaded clip.
1. Choose a Kling model
Kling models differ in three ways: what you give them (a prompt, a first frame, reference images or a source video), the quality tier (Standard, Pro or 4K), and the price. Here is the current lineup:
| Model | Tasks | Billing | Price |
|---|---|---|---|
| Kling 3.0 Omni Pro Video Edit kwaivgi/kling-video/3.0/omni/pro/video-to-video/edit | Provider cost | ≈ $0.84 per clip, reference price | |
| Kling 3.0 Omni Pro Video Reference kwaivgi/kling-video/3.0/omni/pro/video-to-video/reference | Provider cost | ≈ $0.84 per clip, reference price | |
| Kling 3.0 Turbo Pro Image to Video kwaivgi/kling-video/3.0/turbo/pro/image-to-video | Provider cost | ≈ $0.70 per clip, reference price | |
| Kling 3.0 Turbo Pro Text to Video kwaivgi/kling-video/3.0/turbo/pro/text-to-video | Provider cost | ≈ $0.70 per clip, reference price | |
| Kling 3.0 Turbo Standard Image to Video kwaivgi/kling-video/3.0/turbo/standard/image-to-video | Provider cost | ≈ $0.56 per clip, reference price | |
| Kling 3.0 Turbo Standard Text to Video kwaivgi/kling-video/3.0/turbo/standard/text-to-video | Provider cost | ≈ $0.56 per clip, reference price | |
| Kling Video O3 4k Image to Video kwaivgi/kling-video/o3/4k/image-to-video | Provider cost | ≈ $2.10 per clip, reference price | |
| Kling Video O3 4k Reference to Video kwaivgi/kling-video/o3/4k/reference-to-video | Provider cost | ≈ $2.10 per clip, reference price | |
| Kling Video O3 4k Text to Video kwaivgi/kling-video/o3/4k/text-to-video | Provider cost | ≈ $2.10 per clip, reference price | |
| Kling Video V3 4k Image to Video kwaivgi/kling-video/v3/4k/image-to-video | Provider cost | ≈ $2.10 per clip, reference price | |
| Kling Video V3 4k Text to Video kwaivgi/kling-video/v3/4k/text-to-video | Provider cost | ≈ $2.10 per clip, reference price | |
| Kling Video V3 Pro Image to Video kwaivgi/kling-video/v3/pro/image-to-video | Provider cost | ≈ $0.84 per clip, reference price | |
| Kling Video V3 Pro Motion Control kwaivgi/kling-video/v3/pro/motion-control | Provider cost | ≈ $0.84 per clip, reference price | |
| Kling Video V3 Standard kwaivgi/kling-video/v3/standard/motion-control | Provider cost | ≈ $0.63 per clip, reference price |
A practical way to choose:
- Start with text-to-video when you are exploring ideas and have no source imagery.
- Use image-to-video when the first frame has to be exact: a product shot, a character design, a brand asset.
- Use motion control to make the subject of an image perform the movement in a reference video.
- Iterate on a Standard or Turbo tier, then render the final version in Pro or 4K.
2. Get an API key
Sign in to the console with Google (your first sign-in creates the account), top up your wallet with at least $10, and create an API key. Keep the key on your server, for example in an environment variable called SCALINGTENSOR_API_KEY. Never ship it in browser code.
3. Submit a generation job
Video generation takes longer than an HTTP request should stay open, so the API is asynchronous. You send the model ID and its parameters to POST /api/media/generate, and you get a jobId back straight away. Parameters always go inside a params object.
This example animates a product photo with Kling Video V3 Pro Image to Video:
const API = "https://restapi.scalingtensor.com";
const headers = {
apiKey: process.env.SCALINGTENSOR_API_KEY,
"Content-Type": "application/json",
};
const submit = await fetch(`${API}/api/media/generate`, {
method: "POST",
headers,
body: JSON.stringify({
model: "kwaivgi/kling-video/v3/pro/image-to-video",
params: {
image: "https://example.com/product-shot.png",
prompt: "The camera slowly orbits the bottle as morning light moves across the marble.",
duration: 5,
generate_audio: false,
},
}),
}).then((response) => response.json());
if (submit.code !== 0) throw new Error(submit.msg);
const { jobId } = submit.data;The parameters that matter most for Kling image-to-video:
image(required): a public URL of the first frame.prompt(required): what moves and how, up to 2,500 characters. Describe motion and camera, not the picture you already supplied.duration: 3 to 15 seconds, default 5.end_image: an optional last frame, useful for transitions and loops.generate_audio: whether Kling also generates a native audio track.
The same request shape works from any language. With cURL, a text-to-video job on Kling 3.0 Turbo Standard Text to Video looks like this:
curl --request POST 'https://restapi.scalingtensor.com/api/media/generate' \
--header "apiKey: $SCALINGTENSOR_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "kwaivgi/kling-video/3.0/turbo/standard/text-to-video",
"params": {
"prompt": "A red fox trots through fresh snow at dawn, low tracking shot, soft backlight.",
"duration": 5,
"aspect_ratio": "16:9"
}
}'4. Poll until the job finishes
Call GET /api/media/result?jobId=... with the same API key. The job is pending while it queues and renders, then becomes completed or failed. Poll every few seconds, back off gradually, and give up after a timeout you choose:
async function waitForJob(jobId, { timeoutMs = 10 * 60_000 } = {}) {
const deadline = Date.now() + timeoutMs;
let delay = 3_000;
while (Date.now() < deadline) {
const result = await fetch(`${API}/api/media/result?jobId=${jobId}`, { headers })
.then((response) => response.json());
if (result.code !== 0) throw new Error(result.msg);
if (result.data.status === "completed") return result.data.resultData;
if (result.data.status === "failed") throw new Error(`Job ${jobId} failed`);
await new Promise((resolve) => setTimeout(resolve, delay));
delay = Math.min(delay * 1.5, 15_000);
}
throw new Error(`Job ${jobId} did not finish in time`);
}
const output = await waitForJob(jobId);
console.log(output); // contains the provider's result, including the video URL5. Download and store the clip
When the status is completed, resultData contains the provider's result, including the URL of the generated video. Download the file and store it in your own bucket or CDN. Provider URLs are meant for retrieval, not for serving to your users long term.
What it costs
Kling models are billed at the provider's actual cost for each job. Every model lists a reference price for a typical clip; for example Kling 3.0 Turbo Standard Text to Video is listed at ≈ $0.56 per clip, reference price. The exact charge for each request appears in the console's usage log, and all prices are on the pricing page.
Checklist
- Pick the model by input type first, then by tier.
- Keep the API key on the server.
- Save the jobId immediately after submitting.
- Poll with backoff and a timeout.
- Copy the finished video to your own storage.