Google Veo3 Ultra
Googles senaste modell för videogenerering med otrolig realism och fysisk korrekthet.
✓ Ultrarealistisk video
✓ Fysisk korrekthet
✓ Hög upplösning
✓ Snabb generering
Autentisering
För att få åtkomst till Google Veo3 via Doitong API använder du din Doitong API-nyckel. Inkludera den i din GraphQL-mutation eller i REST API-headers.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Snabbstart
Kom igång med Veo-3 API på bara några minuter. Följ dessa enkla steg för att generera din första text to video.
Steg 1: Hämta din API-nyckel
Skapa ett Doitong-konto och gå till din kontrollpanel för att generera en API-nyckel.
Steg 2: Gör ditt första anrop
Använd ett av kodexemplen nedan för att göra ditt första API-anrop.
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": "veo3",
"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: 'veo3',
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": "veo3",
"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": "veo3",
"input": {
"text": "A serene landscape with mountains and a lake at sunset"
},
"options": {
"duration": 5,
"aspectRatio": "16:9",
"version": "veo-3",
"quality": "high"
}
}
}
Prissättning
Veo-3 API använder en kreditbaserad prismodell. Krediter förbrukas baserat på det genererade innehållets komplexitet och varaktighet.
| Funktion | Krediter | Beskrivning |
|---|---|---|
| Standardläge | 100-200 Krediter | 5–10 sekunders video i standardkvalitet |
| Pro-läge | 300-500 Krediter | 5–10 sekunders video i professionell kvalitet |
API-slutpunkter
Veo-3 API är tillgängligt via vår enhetliga GraphQL-slutpunkt.
GraphQL-slutpunkt
POST https://api.doitong.com/graphql
REST-slutpunkt
POST https://api.doitong.com/v1/text_to_video
Parametrar
Tillgängliga parametrar för anrop till Veo-3 API:
| Parameter | Typ | Obligatorisk | Beskrivning |
|---|---|---|---|
service |
Sträng | Yes | Tjänsteidentifierare: "veo3" |
prompt |
Sträng | Yes | Textbeskrivning av vad som ska genereras |
duration |
Heltal | No | Videolängd i sekunder (standard: 5) |
aspectRatio |
Sträng | No | Bildförhållande: "16:9", "9:16", "1:1" (standard: "16:9") |
version |
Sträng | No | Model version: "veo-3" |
webhookUrl |
Sträng | No | URL för att ta emot aviseringar när genereringen är klar |
Svarsformat
Alla API-svar följer ett konsekvent format:
Lyckat svar
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Slutfört svar
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Felhantering
API:et använder standardiserade HTTP-statuskoder och returnerar detaljerade felmeddelanden.
Vanliga felkoder
| Statuskod | Feltyp | Beskrivning |
|---|---|---|
| 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 för felsvar
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhooks
Ta emot aviseringar i realtid när din text to video-generering är klar.
Konfigurera webhooks
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": "veo3",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": 5,
"width": 1920,
"height": 1080
}
}
Webhook-säkerhet
Alla webhook-anrop inkluderar en signatur i headern för verifiering:
X-Doitong-Signature: sha256=abc123...
Hastighetsbegränsningar
För att säkerstäxtälla rättvis användning och systemstabilitet gäller följande begränsningar:
| Nivå | Anrop/minut | Parallella jobb | Daglig gräns |
|---|---|---|---|
| Gratis | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | Anpassad | Anpassad | Obegränsat |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Rekommendationer
1. Optimera dina prompter
Skriv tydliga och beskrivande prompter för bästa resultat:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Hantera asynkron bearbetning
Genereringen sker asynkront. Implementera korrekt polling eller webhooks:
// 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. Felåterställning
Implementera retry-logik med exponentiell 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. Övervaka kreditförbrukning
Håll koll på din kreditförbrukning för att undvika avbrott:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Redo att komma igång?
Gör som tusentals andra utvecklare och använd Veo-3 API för att skapa fantastiskt innehåll