Runway Creative Suite
Te whakaohooho atahanga ngaio me ngā tauira Gen-2, Gen-3, me te Gen4. He hua rite ki te kiriata.
✓ Tauira Gen-2, Gen-3, Gen4
✓ Whakaohooho atahanga
✓ Mana nekehanga
✓ Kounga HD
Whakamotuhēhē
Hei uru atu ki a Runway mā te API o Doitong, whakamahia tō kī API Doitong. Whauruhia ki te mutation GraphQL, ki ngā pane API REST rānei.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Tīmata Tere
Tīmatahia te whakamahi i a Runway Gen4 API i roto i te iti noa o te wā. Whāia ēnei takahanga māmā hei whakaputa i tō text to video tuatahi.
Takahanga 1: Tikina tō Kī API
Waitohu ki tētahi pūkete Doitong, ka haere ki tō papatohu hei whakaputa i tētahi kī API.
Takahanga 2: Kōkirihia tō Tono Tuatahi
Whakamahia tētahi o ngā tauira waehere i raro nei hei kōkiri i tō karanga API tuatahi.
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"
}
}
}
Utu
E whakamahi ana a Runway Gen4 API i tētahi tauira utu i runga i te whiwhinga (credit). Ka pau ngā whiwhinga i runga i te uaua me te roa o te ihirangi ka whakaputaina.
| Āhuatanga | Whiwhinga | Whakaahuatanga |
|---|---|---|
| Aratau Paerewa | 100-200 Whiwhinga | He ataata 5-10 hēkona i te kounga paerewa |
| Aratau Pro | 300-500 Whiwhinga | He ataata 5-10 hēkona i te kounga ngaio |
Ngā Pae API
E wātea ana a Runway Gen4 API mā tō mātou pae GraphQL kōmitimiti.
Pae GraphQL
POST https://api.doitong.com/graphql
Pae REST
POST https://api.doitong.com/v1/text_to_video
Ngā Tawhā
Ngā tawhā e wātea ana mō ngā tono Runway Gen4 API:
| Tawhā | Momo | Me mātua whai | Whakaahuatanga |
|---|---|---|---|
service |
Pūāhua | Yes | Kaitohu Ratonga: "runway" |
prompt |
Pūāhua | Yes | He whakaahuatanga tuhi o te mea hei whakaputa |
duration |
Tauoti | No | Te roa o te ataata i roto i te hēkona (taunoa: 5) |
aspectRatio |
Pūāhua | No | Te hāngaitanga: "16:9", "9:16", "1:1" (taunoa: "16:9") |
version |
Pūāhua | No | Model version: "gen-2", "gen-3", "gen-4" |
webhookUrl |
Pūāhua | No | Te URL hei whiwhi whakamōhiotanga ina oti |
Hōputu Whakahoki
He rite tonu te hōputu o ngā whakahoki API katoa:
Whakahoki Angitu
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Whakahoki Kua Oti
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Whakahaere Hapa
E whakamahi ana te API i ngā waehere tūnga HTTP paerewa, ā, ka whakahokia mai he karere hapa taipitopito.
Ngā Waehere Hapa Noa
| Waehere Tūnga | Momo Hapa | Whakaahuatanga |
|---|---|---|
| 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 |
Hōputu Whakahoki Hapa
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Matau Tukutuku
Whiwhi whakamōhiotanga hāora-tūturu ina oti te whakaputa i tō text to video.
Whakarite Matau Tukutuku
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Raraunga Matau Tukutuku
{
"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
}
}
Haumarutanga Matau Tukutuku
Kei roto i ngā tono matau tukutuku katoa he pane waitohu hei whakamana:
X-Doitong-Signature: sha256=abc123...
Ngā Tepe Tere
Hei whakarite i te whakamahinga tika me te pūmautanga o te pūnaha, ka whai mana ēnei tepe tere:
| Mahere | Tono/Meneti | Mahi Tukutahi | Tepe ia Rā |
|---|---|---|---|
| Koreutu | 10 | 1 | 100 |
| Tīmata | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Taurima | Whaiaro | Whaiaro | Mutunga Kore |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Ngā Tikanga Pai
1. Whakapai ake i ō Tono (Prompts)
Tuhia he tono mārama, he tono whakaahua hoki kia whiwhi ai i ngā hua pai rawa atu:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Whakahaerehia te Tukatuka Tukutahi-kore (Async)
He tukutahi-kore te mahi whakaputa. Whakaritea he pūnaha tirotiro (polling), he matau tukutuku rānei:
// 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. Whakaora Hapa
Whakaritea he arorau ngana-anō me te whakaroa haere (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. Aroturuki i te Whakamahinga Whiwhinga
Aroturukihia tō whakapau whiwhinga kia kore ai e haukotia te mahi:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Kua reri ki te tīmata?
Hono atu ki ngā mano tini kaiwhakawhanake e whakamahi ana i a Runway Gen4 API ki te hanga ihirangi mīharo