Runway Image Animation API
Professional image animation with cinema-quality results
✓ Cinema quality
✓ 16:9/9:16
✓ Pro tools
✓ Motion control
Authenticatie
Gebruik je Doitong API-key om toegang te krijgen tot Runway Image-to-Video API via de Doitong API. Voeg deze toe aan de GraphQL-mutatie of de REST API-headers.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Snel aan de slag
Ga binnen enkele minuten aan de slag met Runway Image-to-Video API. Volg deze eenvoudige stappen om je eerste image to video te genereren.
Stap 1: Ontvang je API-key
Maak een Doitong-account aan en ga naar je dashboard om een API-key te genereren.
Stap 2: Doe je eerste verzoek
Gebruik een van de onderstaande codevoorbeelden voor je eerste API-aanroep.
curl -X POST https://api.doitong.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: unique-request-id-123" \
-d '{
"query": "mutation Generate($input: GenerateInput!) { generate(input: $input) { id status type provider url metadata creditCost } }",
"variables": {
"input": {
"type": "VIDEO",
"provider": "runway-i2v",
"input": {
"image": "https://example.com/your-image.jpg"
},
"options": {
"duration": 5,
"motionIntensity": "medium"
}
}
}
}'
const response = await fetch('https://api.doitong.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
query: `
mutation AnimateImage($input: ImageAnimationInput!) {
animateImage(input: $input) {
id
status
url
}
}
`,
variables: {
input: {
service: 'runway-i2v',
imageUrl: 'https://example.com/your-image.jpg',
duration: 5,
motionIntensity: 'medium'
}
}
})
});
const data = await response.json();
console.log('Animated Video:', data.data.animateImage);
import requests
import json
url = "https://api.doitong.com/graphql"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
query = """
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
}
}
"""
variables = {
"input": {
"type": "VIDEO",
"provider": "runway-i2v",
"input": {
"imageUrl": "https://example.com/your-image.jpg"
},
"options": {
"duration": 5,
"motionIntensity": "medium"
}
}
}
response = requests.post(url, json={
"query": query,
"variables": variables
}, headers=headers)
data = response.json()
print("Result:", data["data"]["generate"])
mutation Generate($input: GenerateInput!) {
generate(input: $input) {
id
status
type
provider
url
metadata
creditCost
createdAt
}
}
# Variables
{
"input": {
"type": "VIDEO",
"provider": "runway-i2v",
"input": {
"imageUrl": "https://example.com/your-image.jpg"
},
"options": {
"duration": 5,
"motionIntensity": "medium",
"version": "gen-4"
}
}
}
Tarieven
Runway Image-to-Video API maakt gebruik van een prijsmodel op basis van credits. Credits worden verbruikt op basis van de complexiteit en de duur van de gegenereerde content.
| Functie | Credits | Beschrijving |
|---|---|---|
| Basisgebruik | 10-50 Credits | Standaardkwaliteit en -duur |
| Premium gebruik | 100-500 Credits | Hoge kwaliteit en uitgebreide functies |
API-endpoints
Runway Image-to-Video API is beschikbaar via ons universele GraphQL-endpoint.
GraphQL-endpoint
POST https://api.doitong.com/graphql
REST-endpoint
POST https://api.doitong.com/v1/image_to_video
Parameters
Beschikbare parameters voor Runway Image-to-Video API-aanvragen:
| Parameter | Type | Verplicht | Beschrijving |
|---|---|---|---|
service |
String | Yes | Service-ID: "runway-i2v" |
prompt |
String | Yes | Tekstuele beschrijving van wat er gegenereerd moet worden |
duration |
Integer | No | Videoduur in seconden (standaard: 5) |
aspectRatio |
String | No | Beeldverhouding: "16:9", "9:16", "1:1" (standaard: "16:9") |
version |
String | No | Model version: "gen-2", "gen-3", "gen-4" |
webhookUrl |
String | No | URL voor het ontvangen van voltooiingsmeldingen |
Responsformaat
Alle API-antwoorden volgen een consistent formaat:
Succesvolle respons
{
"data": {
"imagevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Voltooide respons
{
"data": {
"imagevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Foutafhandeling
De API maakt gebruik van standaard HTTP-statuscodes en retourneert gedetailleerde foutmeldingen.
Veelvoorkomende foutcodes
| Statuscode | Fouttype | Beschrijving |
|---|---|---|
| 400 | Bad Request | Invalid parameters or malformed request |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Insufficient credits |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error, please retry |
Foutrespons-formaat
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhooks
Ontvang realtime meldingen zodra de generatie van je image to video is voltooid.
Webhooks instellen
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Webhook-payload
{
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"service": "runway-i2v",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": 5,
"width": 1920,
"height": 1080
}
}
Webhook-beveiliging
Alle webhook-verzoeken bevatten een signature-header ter verificatie:
X-Doitong-Signature: sha256=abc123...
Rate limits
Om eerlijk gebruik en systeemstabiliteit te garanderen, gelden de volgende limieten:
| Abonnement | Requests/minuut | Gelijktijdige taken | Dagelijkse limiet |
|---|---|---|---|
| Gratis | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | Maatwerk | Maatwerk | Onbeperkt |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Best practices
1. Optimaliseer je prompts
Schrijf duidelijke, beschrijvende prompts voor de beste resultaten:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Verwerk asynchrone processen
Generatie is asynchroon. Implementeer polling of webhooks op de juiste manier:
// Polling example
async function pollStatus(jobId) {
let status = 'processing';
while (status === 'processing') {
await sleep(2000); // Wait 2 seconds
const result = await checkJobStatus(jobId);
status = result.status;
}
return result;
}
3. Foutherstel
Implementeer retry-logica met exponential backoff:
async function retryWithBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await sleep(Math.pow(2, i) * 1000);
}
}
}
4. Monitor je creditverbruik
Houd je verbruik bij om onderbrekingen te voorkomen:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Klaar om te beginnen?
Sluit je aan bij duizenden developers die Runway Image-to-Video API gebruiken om geweldige content te maken