Google Veo3 Ultra
Model penjanaan video terbaru Google dengan realisme luar biasa dan ketepatan fizikal.
✓ Video ultra-realistik
✓ Ketepatan fizikal
✓ Resolusi tinggi
✓ Penjanaan pantas
Pengesahan
Untuk mengakses Google Veo3 melalui API Doitong, gunakan kunci API Doitong anda. Sertakannya dalam mutasi GraphQL atau pengepala API REST.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Mula Pantas
Mulakan dengan Veo-3 API dalam masa beberapa minit sahaja. Ikuti langkah mudah ini untuk menjana text to video pertama anda.
Langkah 1: Dapatkan Kunci API Anda
Daftar akaun Doitong dan pergi ke papan pemuka anda untuk menjana kunci API.
Langkah 2: Buat Permintaan Pertama Anda
Gunakan salah satu contoh kod di bawah untuk membuat panggilan API pertama anda.
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"
}
}
}
Harga
Veo-3 API menggunakan model harga berasaskan kredit. Kredit ditolak berdasarkan kerumitan dan tempoh kandungan yang dijana.
| Ciri | Kredit | Penerangan |
|---|---|---|
| Mod Standard | 100-200 Kredit | Video 5-10 saat pada kualiti standard |
| Mod Pro | 300-500 Kredit | Video 5-10 saat pada kualiti profesional |
Titik Akhir API
Veo-3 API tersedia melalui titik akhir GraphQL kami yang bersatu.
Titik Akhir GraphQL
POST https://api.doitong.com/graphql
Titik Akhir REST
POST https://api.doitong.com/v1/text_to_video
Parameter
Parameter yang tersedia untuk permintaan Veo-3 API:
| Parameter | Jenis | Wajib | Penerangan |
|---|---|---|---|
service |
Rentetan | Yes | Pengecam perkhidmatan: "veo3" |
prompt |
Rentetan | Yes | Penerangan teks tentang perkara yang ingin dijana |
duration |
Integer | No | Tempoh video dalam saat (lalai: 5) |
aspectRatio |
Rentetan | No | Nisbah aspek: "16:9", "9:16", "1:1" (lalai: "16:9") |
version |
Rentetan | No | Model version: "veo-3" |
webhookUrl |
Rentetan | No | URL untuk menerima pemberitahuan selesai |
Format Respons
Semua respons API mengikut format yang konsisten:
Respons Berjaya
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Respons Selesai
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Pengendalian Ralat
API ini menggunakan kod status HTTP standard dan mengembalikan mesej ralat yang terperinci.
Kod Ralat Biasa
| Kod Status | Jenis Ralat | Penerangan |
|---|---|---|
| 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 Respons Ralat
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhook
Terima pemberitahuan masa nyata apabila penjanaan text to video anda selesai.
Menetapkan Webhook
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Payload Webhook
{
"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
}
}
Keselamatan Webhook
Semua permintaan webhook menyertakan pengepala tandatangan untuk pengesahan:
X-Doitong-Signature: sha256=abc123...
Had Kadar
Untuk memastikan penggunaan yang adil dan kestabilan sistem, had kadar berikut dikenakan:
| Pelan | Permintaan/Minit | Tugasan Serentak | Had Harian |
|---|---|---|---|
| Percuma | 10 | 1 | 100 |
| Permulaan | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Perusahaan | Tersuai | Tersuai | Tanpa Had |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Amalan Terbaik
1. Optimumkan Gesaan Anda
Tulis gesaan yang jelas dan deskriptif untuk hasil terbaik:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Kendalikan Pemprosesan Asinkron
Penjanaan adalah asinkron. Laksanakan 'polling' atau webhook yang betul:
// 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. Pemulihan Ralat
Laksanakan logik cuba semula dengan 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. Pantau Penggunaan Kredit
Jejaki penggunaan kredit anda untuk mengelakkan gangguan perkhidmatan:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Bersedia untuk Bermula?
Sertai beribu-ribu pembangun yang menggunakan Veo-3 API untuk mencipta kandungan yang menakjubkan