Runway Creative Suite

Profesionalna animacija slik z modeli Gen-2, Gen-3 in Gen4. Rezultati filmske kakovosti.

✓ Modeli Gen-2, Gen-3, Gen4

✓ Animacija slik

✓ Nadzor gibanja

✓ HD kakovost

Avtentikacija

Za dostop do storitve Runway prek API-ja Doitong uporabite svoj API ključ. Vključite ga v mutacijo GraphQL ali v glave REST API-ja.

Pomembno: Svoj API ključ Doitong skrbno varujte in ga nikoli ne razkrivajte v kodi na strani odjemalca. API klice vedno izvajajte iz svojega zalednega strežnika.
// GraphQL Header
{
  "Authorization": "Bearer YOUR_API_KEY"
}

// REST Header
"X-API-Key": "YOUR_API_KEY"

Hitri začetek

Začnite uporabljati Runway Gen4 API v le nekaj minutah. Sledite tem preprostim korakom za ustvarjanje svoje prve text to video.

1. korak: Pridobite API ključ

Registrirajte se za račun Doitong in v nadzorni plošči ustvarite svoj API ključ.

2. korak: Izvedite prvo zahtevo

Uporabite enega od spodnjih primerov kode za svoj prvi klic API.

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",
        "input": {
          "text": "A serene landscape with mountains and a lake at sunset"
        },
        "options": {
          "duration": 5,
          "aspectRatio": "16:9"
        }
      }
    }
  }'
const response = await fetch('https://api.doitong.com/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY',
    'Idempotency-Key': 'unique-request-id-123'
  },
  body: JSON.stringify({
    query: `
      mutation Generate($input: GenerateInput!) {
        generate(input: $input) {
          id
          status
          type
          provider
          url
          metadata
          creditCost
        }
      }
    `,
    variables: {
      input: {
        type: 'VIDEO',
        provider: 'runway',
        input: {
          text: 'A serene landscape with mountains and a lake at sunset'
        },
        options: {
          duration: 5,
          aspectRatio: '16:9'
        }
      }
    }
  })
});

const data = await response.json();
console.log('Result:', data.data.generate);
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",
        "input": {
            "text": "A serene landscape with mountains and a lake at sunset"
        },
        "options": {
            "duration": 5,
            "aspectRatio": "16:9"
        }
    }
}

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",
    "input": {
      "text": "A serene landscape with mountains and a lake at sunset"
    },
    "options": {
      "duration": 5,
      "aspectRatio": "16:9",
      "version": "gen-4",
      "quality": "high"
    }
  }
}

Cenik

Runway Gen4 API uporablja model cen na podlagi kreditov. Krediti se porabijo glede na kompleksnost in trajanje ustvarjene vsebine.

Funkcija Krediti Opis
Standardni način 100-200 Krediti 5–10 sekundni video standardne kakovosti
Pro način 300-500 Krediti 5–10 sekundni video profesionalne kakovosti

Končne točke API

Runway Gen4 API je na voljo prek naše enotne končne točke GraphQL.

Končna točka GraphQL

POST https://api.doitong.com/graphql

Končna točka REST

POST https://api.doitong.com/v1/text_to_video

Parametri

Razpoložljivi parametri za zahteve Runway Gen4 API:

Parameter Vrsta Obvezno Opis
service Niz Yes Identifikator storitve: "runway"
prompt Niz Yes Besedilni opis vsebine za generiranje
duration Celo število No Trajanje videa v sekundah (privzeto: 5)
aspectRatio Niz No Razmerje stranic: "16:9", "9:16", "1:1" (privzeto: "16:9")
version Niz No Model version: "gen-2", "gen-3", "gen-4"
webhookUrl Niz No URL za prejem obvestil o dokončanju

Format odgovora

Vsi odgovori API-ja sledijo enotnemu formatu:

Odgovor ob uspehu

{
  "data": {
    "generatevideo": {
      "id": "abc123xyz",
      "status": "processing",
      "url": null,
      "webhookUrl": "https://your-webhook.com/callback",
      "createdAt": "2024-01-01T00:00:00Z"
    }
  }
}

Odgovor ob dokončanju

{
  "data": {
    "generatevideo": {
      "id": "abc123xyz",
      "status": "completed",
      "url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
      "duration": 5,
      "createdAt": "2024-01-01T00:00:00Z"
    }
  }
}

Obravnava napak

API uporablja standardne statusne kode HTTP in vrača podrobna sporočila o napakah.

Pogoste kode napak

Statusna koda Vrsta napake Opis
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

Format odgovora ob napaki

{
  "errors": [
    {
      "message": "Insufficient credits for this operation",
      "extensions": {
        "code": "INSUFFICIENT_CREDITS",
        "creditsRequired": 100,
        "creditsAvailable": 50
      }
    }
  ]
}

Webhooki

Prejemajte obvestila v realnem času, ko je generiranje vaše text to video končano.

Nastavitev webhookov

Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.

Vsebina webhooka

{
  "id": "abc123xyz",
  "status": "completed",
  "url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
  "service": "runway",
  "createdAt": "2024-01-01T00:00:00Z",
  "completedAt": "2024-01-01T00:01:00Z",
  "metadata": {
    "duration": 5,
    "width": 1920,
    "height": 1080
  }
}

Varnost webhookov

Vse zahteve webhookov vključujejo glavo s podpisom za preverjanje:

X-Doitong-Signature: sha256=abc123...

Omejitve števila zahtev

Za zagotavljanje poštene uporabe in stabilnosti sistema veljajo naslednje omejitve:

Paket Zahtev/minuto Vzporedna opravila Dnevna omejitev
Brezplačno 10 1 100
Starter 30 3 1,000
Pro 60 10 10,000
Enterprise Po meri Po meri Neomejeno
Glave omejitev (Rate Limit): Preverite glave odgovorov za trenutno stanje omejitev:
  • X-RateLimit-Limit: Maximum requests per window
  • X-RateLimit-Remaining: Requests remaining
  • X-RateLimit-Reset: Window reset timestamp

Najboljše prakse

1. Optimizirajte svoje pozive

Za najboljše rezultate pišite jasne in opisne pozive:

  • Be specific about visual elements, style, and mood
  • Include details about lighting, camera angles, and composition
  • Avoid contradictory or impossible requests

2. Upravljajte asinhrono obdelavo

Generiranje je asinhrono. Implementirajte ustrezno poizvedovanje (polling) ali webhooke:

// 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. Obnovitev po napakah

Implementirajte logiko ponovnega poskusa z eksponentnim zamikom:

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. Spremljajte porabo kreditov

Sledite porabi kreditov, da se izognete prekinitvam storitve:

  • Check credit balance before large batch operations
  • Set up alerts for low credit thresholds
  • Implement credit-aware request queuing

Ste pripravljeni na začetek?

Pridružite se tisočem razvijalcev, ki uporabljajo Runway Gen4 API za ustvarjanje neverjetnih vsebin

Pridobite API ključ zdaj Oglejte si cenik