---
title: Kling tekst naar afbeelding | RunAPI
description: Genereer standaardafbeeldingen, geordende series en lange afbeeldingen
  voor e-commerce of webpagina's.
url: https://runapi.ai/nl/docs/api/kling/text-to-image.md
canonical: https://runapi.ai/nl/docs/api/kling/text-to-image
locale: nl
---

> HTML-versie: https://runapi.ai/nl/docs/api/kling/text-to-image
> Site-index voor agents: https://runapi.ai/llms.txt

# Kling tekst naar afbeelding

## Overzicht

Gebruik het eindpunt voor tekst naar afbeelding met een ondersteund model. Gebruik de geretourneerde taak-ID om de status op te halen, of geef callback_url op voor de hieronder gedocumenteerde leveringen.

### Snelstart

1. Maak een API-sleutel aan en stel deze in als RUNAPI_API_KEY.
2. Kies een ondersteund model en stuur een POST-verzoek waarvan de body overeenkomt met het schema van dat model.
3. Sla de geretourneerde taak-ID op en poll vervolgens totdat een eindstatus is bereikt, of verwerk de hieronder gedocumenteerde callbacks.

## Eindpunt

POST /api/v1/kling/text_to_image

Basis-URL: https://runapi.ai

API-versie: v1

Authenticatie: Authorization: Bearer YOUR_API_TOKEN

## Ondersteunde modellen

Open een modelpagina voor actuele prijzen, snelheidslimieten en details over commercieel gebruik.

- [kling-v4-image](https://runapi.ai/nl/models/kling/v4-image)
- [kling-v4-long-image](https://runapi.ai/nl/models/kling/v4-long-image)

## Verzoekschema

Velden en toegestane waarden zijn afhankelijk van het geselecteerde model. Indien opgegeven, ontvangt callback_url de hieronder gedocumenteerde taakaflevering.

### kling-v4-image

```json
{
  "aspect_ratio": {
    "default": "auto",
    "description": "Uitvoer-beeldverhouding.",
    "enum": [
      "auto",
      "9:16",
      "2:3",
      "3:4",
      "1:1",
      "4:3",
      "3:2",
      "16:9",
      "21:9"
    ],
    "type": "string"
  },
  "callback_url": {
    "description": "Webhook-URL voor asynchrone meldingen.",
    "type": "string"
  },
  "elements": {
    "description": "Benoemde verwijzingen, die elk als één invoermateriaal tellen. Namen zijn uniek zonder onderscheid tussen hoofd- en kleine letters; image_N en object_N zijn gereserveerd.",
    "items": {
      "properties": {
        "description": {
          "length": true,
          "max": 100,
          "type": "string"
        },
        "image_urls": {
          "items": {
            "type": "string"
          },
          "max_items": 4,
          "min_items": 2,
          "required": true,
          "type": "array"
        },
        "name": {
          "length": true,
          "max": 20,
          "min": 1,
          "required": true,
          "type": "string"
        },
        "tag": {
          "enum": [
            "character",
            "animal",
            "prop",
            "costume",
            "scene",
            "effect",
            "others"
          ],
          "type": "string"
        }
      },
      "type": "object"
    },
    "max_items": 10,
    "type": "array"
  },
  "mode": {
    "default": "default",
    "description": "Enkele of standaardgeneratie, of een samenhangende afbeeldingenserie.",
    "enum": [
      "default",
      "series"
    ],
    "type": "string"
  },
  "model": {
    "description": "Model-slug voor Kling 4.0-afbeeldingen.",
    "required": true,
    "type": "string"
  },
  "output_count": {
    "default": 1,
    "description": "1–9 in de standaardmodus; 2–10 verplicht in de seriemodus.",
    "max": 10,
    "min": 1,
    "type": "integer"
  },
  "output_resolution": {
    "default": "2k",
    "description": "Uitvoerresolutie.",
    "enum": [
      "2k",
      "4k",
      "8k"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "Afbeeldingsbeschrijving; verwijs naar aangeleverde afbeeldingen met @image_N of naar elementen met @name.",
    "length": true,
    "max": 20000,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "source_image_urls": {
    "description": "Openbare JPG- of PNG-afbeeldingen via HTTP/HTTPS, maximaal 20 MB per stuk. Afbeeldingen en elementen samen maximaal 10.",
    "items": {
      "type": "string"
    },
    "max_items": 10,
    "type": "array"
  }
}
```

### kling-v4-long-image

```json
{
  "callback_url": {
    "description": "Webhook-URL voor asynchrone meldingen.",
    "type": "string"
  },
  "length": {
    "default": "medium",
    "description": "Lengte van de e-commerceafbeelding.",
    "enum": [
      "short",
      "medium",
      "long"
    ],
    "type": "string"
  },
  "model": {
    "description": "Model-slug voor lange Kling 4.0-afbeeldingen.",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "2k",
    "description": "Uitvoerresolutie.",
    "enum": [
      "1k",
      "2k"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "Beschrijving van de lange afbeelding. Verwijzingen moeten aangeleverde afbeeldingen noemen: @image_N, @style of @subject.",
    "length": true,
    "max": 20000,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "skill": {
    "description": "Skill voor lange afbeeldingen; niet hoofdlettergevoelig.",
    "enum": [
      "ecommerce",
      "webpage"
    ],
    "required": true,
    "type": "string"
  },
  "source_image_urls": {
    "description": "E-commerceproductafbeeldingen: openbare JPG of PNG via HTTP/HTTPS, maximaal 20 MB per stuk.",
    "items": {
      "type": "string"
    },
    "max_items": 3,
    "min_items": 1,
    "type": "array"
  },
  "style_image_url": {
    "description": "Optionele stijlreferentie voor de webpagina: openbare JPG of PNG via HTTP/HTTPS, maximaal 20 MB.",
    "type": "string"
  },
  "subject_image_url": {
    "description": "Optionele onderwerpreferentie voor de webpagina: openbare JPG of PNG via HTTP/HTTPS, maximaal 20 MB.",
    "type": "string"
  }
}
```

#### Voorwaardelijke regels

Deze vereisten zijn van toepassing wanneer alle vermelde voorwaarden overeenkomen.

- **Wanneer**: `model` = `kling-v4-image`; **Niet geaccepteerd**: `skill`, `length`, `style_image_url`, `subject_image_url`
- **Wanneer**: `mode` = `series`, `model` = `kling-v4-image`; **Vereist**: `output_count`
- **Wanneer**: `mode` = `default`, `model` = `kling-v4-image`
- **Wanneer**: `mode absent`, `model` = `kling-v4-image`
- **Wanneer**: `model` = `kling-v4-long-image`; **Niet geaccepteerd**: `mode`, `output_count`, `elements`, `aspect_ratio`
- **Wanneer**: `model` = `kling-v4-long-image`, `skill` = `ecommerce`; **Vereist**: `source_image_urls`; **Niet geaccepteerd**: `style_image_url`, `subject_image_url`
- **Wanneer**: `model` = `kling-v4-long-image`, `skill` = `webpage`; **Niet geaccepteerd**: `source_image_urls`, `length`

## Acceptatie aanmaken

HTTP 202 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Pollen bezig

HTTP 200 - GET /api/v1/kling/text_to_image/:id

### Responsschema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Pollen voltooid

HTTP 200 - GET /api/v1/kling/text_to_image/:id

### Responsschema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "images": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "images",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "id": "tsk_reference_demo",
  "images": [
    {
      "url": "https://cdn.runapi.ai/public/samples/image.jpg"
    }
  ],
  "status": "completed",
  "usage": {
    "cost": 0.05
  }
}
```

## Pollen mislukt

HTTP 200 - GET /api/v1/kling/text_to_image/:id

### Responsschema

```json
{
  "properties": {
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Callback van klant: voltooid

HTTP 200 - POST callback_url

### Responsschema

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "images": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  },
  "required": [
    "id",
    "status",
    "images",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "id": "tsk_reference_demo",
  "images": [
    {
      "url": "https://cdn.runapi.ai/public/samples/image.jpg"
    }
  ],
  "status": "completed",
  "usage": {
    "cost": 0.05
  }
}
```

## Callback van klant: mislukt

HTTP 200 - POST callback_url

### Responsschema

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Fouten

HTTP 401 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Authentication required"
}
```

## Fouten

HTTP 401 - GET /api/v1/kling/text_to_image/:id

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Authentication required"
}
```

## Fouten

HTTP 400 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Leesbare foutmelding.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Leesbare validatiesamenvatting.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Validatieberichten gekoppeld aan het openbare aanvraagveld, met een reeks leesbare tekenreeksen per veld.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Responsvoorbeeld

```json
{
  "error": "model must be one of: kling-v4-image, kling-v4-long-image"
}
```

## Fouten

HTTP 402 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Insufficient balance"
}
```

## Fouten

HTTP 429 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "API key credit limit exceeded"
}
```

## Fouten

HTTP 409 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## Fouten

HTTP 429 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## Fouten

HTTP 503 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## Fouten

HTTP 503 - POST /api/v1/kling/text_to_image

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "The request timed out"
}
```

## Fouten

HTTP 404 - GET /api/v1/kling/text_to_image/:id

### Responsschema

```json
{
  "properties": {
    "error": {
      "description": "Leesbare foutmelding.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Responsvoorbeeld

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## Gegenereerde codevoorbeelden

Gebruik cURL rechtstreeks, of installeer een SDK voor uw taal. Elk voorbeeld dient het gevalideerde verzoek in dat in deze referentie wordt getoond.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/kling/text_to_image \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"kling-v4-image","prompt":"A red apple on a white table","output_resolution":"2k","output_count":1}'
```

### javascript

#### Installeren

```bash
npm install @runapi.ai/kling
```

```javascript
import { KlingClient } from "@runapi.ai/kling";

const client = new KlingClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.textToImage.create({
  "model": "kling-v4-image",
  "prompt": "A red apple on a white table",
  "output_resolution": "2k",
  "output_count": 1
});
```

### python

#### Installeren

```bash
pip install runapi-kling
```

```python
import os
from runapi.kling import KlingClient

client = KlingClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_image.create(
  model="kling-v4-image",
  prompt="A red apple on a white table",
  output_resolution="2k",
  output_count=1
)
```

### go

#### Installeren

```bash
go get github.com/runapi-ai/kling-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  kling "github.com/runapi-ai/kling-sdk/go/kling"
)

func main() {
  client, err := kling.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.TextToImage.Create(context.Background(), kling.TextToImageParams{
    Model: kling.TextToImageModel("kling-v4-image"),
    Prompt: "A red apple on a white table",
    OutputResolution: "2k",
    OutputCount: 1,
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### Installeren

```bash
gem install runapi-kling
```

```ruby
require "runapi/kling"

client = RunApi::Kling::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.text_to_image.create(
  model: "kling-v4-image",
  prompt: "A red apple on a white table",
  output_resolution: "2k",
  output_count: 1
)
```

### java

#### Installeren

```kotlin
implementation("ai.runapi:runapi-kling")
```

```java
import ai.runapi.kling.KlingClient;
import ai.runapi.kling.types.TextToImageParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    KlingClient client = KlingClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.textToImage().create(
        TextToImageParams.builder()
        .model(new ai.runapi.kling.types.TextToImageModel("kling-v4-image"))
        .prompt("A red apple on a white table")
        .outputResolution("2k")
        .outputCount(1)
            .build()
    );
  }
}
```

### php

#### Installeren

```bash
composer require runapi-ai/kling
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Kling\KlingClient;

$client = new KlingClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->textToImage->create([
  "model" => "kling-v4-image",
  "prompt" => "A red apple on a white table",
  "output_resolution" => "2k",
  "output_count" => 1
]);
```

## Gerelateerde handleidingen

- [Authenticatie](https://runapi.ai/nl/docs/guides/authentication.md)
- [Snelstart](https://runapi.ai/nl/docs/guides/task-api/quickstart.md)
- [Kling 4.0-afbeeldingen](https://runapi.ai/nl/docs/guides/task-api/kling-images.md)

---

## Meer van RunAPI

- [Home](https://runapi.ai/nl/.md)
- [Modelcatalogus](https://runapi.ai/nl/models.md)
- [Prijzen](https://runapi.ai/nl/pricing.md)
- [Providers](https://runapi.ai/nl/models)
- [Promptgalerij](https://runapi.ai/nl/prompts.md)
- [Documentatie](https://runapi.ai/nl/docs/guides)
- [SDK's](https://runapi.ai/nl/sdk.md)
- [CLI](https://runapi.ai/nl/cli.md)
- [MCP Server](https://runapi.ai/nl/mcp.md)
- [x402](https://runapi.ai/nl/x402.md)
- [Claude Code vs Cursor](https://runapi.ai/nl/claude-code-vs-cursor.md)
- [Cursor API instellen](https://runapi.ai/nl/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/nl/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/nl/contact.md)
- [Verwijzingsprogramma](https://runapi.ai/nl/referral-program.md)
- [Contact](https://runapi.ai/nl/contact.md)
- [Voorwaarden](https://runapi.ai/nl/terms.md)
- [Privacy](https://runapi.ai/nl/privacy.md)
- [Site-index voor agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Gestructureerde gegevens

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/nl",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/nl/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/nl",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/icon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "nl",
    "@type": "TechArticle",
    "headline": "Kling tekst naar afbeelding",
    "description": "Genereer standaardafbeeldingen, geordende series en lange afbeeldingen voor e-commerce of webpagina's.",
    "url": "https://runapi.ai/nl/docs/api/kling/text-to-image",
    "mainEntityOfPage": "https://runapi.ai/nl/docs/api/kling/text-to-image"
  }
]
```
