Doitong ਡਿਵੈਲਪਰ ਪੋਰਟਲ

ਮੁਕੰਮਲ AI ਕੰਟੈਂਟ ਜਨਰੇਸ਼ਨ API ਸੂਟ

ਇੱਕ ਸਿੰਗਲ ਯੂਨੀਫਾਈਡ API ਰਾਹੀਂ 30+ ਅਤਿ-ਆਧੁਨਿਕ AI ਮਾਡਲਾਂ ਤੱਕ ਪਹੁੰਚ ਕਰੋ। ਇੰਡਸਟਰੀ-ਲੀਡਿੰਗ ਕੁਆਲਿਟੀ ਦੇ ਨਾਲ ਵੀਡੀਓ, ਚਿੱਤਰ, ਅਵਤਾਰ ਅਤੇ ਆਵਾਜ਼ ਤਿਆਰ ਕਰੋ।

30+
AI Models
8
Video APIs
9
Image Models
99.9%
Uptime SLA
<2s
Avg Response

ਟੈਕਸਟ-ਟੂ-ਵੀਡੀਓ APIs

ਦੁਨੀਆ ਦੇ ਸਭ ਤੋਂ ਉੱਨਤ AI ਵੀਡੀਓ ਮਾਡਲਾਂ ਨਾਲ ਟੈਕਸਟ ਪ੍ਰੋਂਪਟਾਂ ਨੂੰ ਸ਼ਾਨਦਾਰ ਵੀਡੀਓਜ਼ ਵਿੱਚ ਬਦਲੋ

🎬
Kling
Kuaishou Technology

6 ਵਰਜ਼ਨਾਂ (1.0-2.1) ਦੇ ਨਾਲ ਇੰਡਸਟਰੀ-ਲੀਡਿੰਗ ਵੀਡੀਓ ਜਨਰੇਸ਼ਨ। ਸਟੈਂਡਰਡ ਅਤੇ ਪ੍ਰੋ ਮੋਡਸ, 5-10 ਸੈਕਿੰਡ ਵੀਡੀਓ, ਬੇਮਿਸਾਲ ਮੋਸ਼ਨ ਕੋਹੇਰੈਂਸ ਦਾ ਸਮਰਥਨ ਕਰਦਾ ਹੈ।

v1.0 - v2.1 5-10 ਸੈਕਿੰਡ ਪ੍ਰੋ ਮੋਡ 1080p
🚀
Minimax / Hailuo-02
Minimax Technology

ਬੇਮਿਸਾਲ ਸੀਨ ਸਮਝ ਅਤੇ ਕੁਦਰਤੀ ਮੋਸ਼ਨ ਦੇ ਨਾਲ ਉੱਨਤ ਵੀਡੀਓ ਜਨਰੇਸ਼ਨ। ਉਪਲਬਧ ਮਾਡਲਾਂ ਵਿੱਚ Hailuo-02 ਅਤੇ HailuoI2V ਸ਼ਾਮਲ ਹਨ।

1280x720 5 ਸੈਕਿੰਡ ਕੁਦਰਤੀ ਮੋਸ਼ਨ ਤੇਜ਼ ਜਨਰੇਸ਼ਨ
Veo-3
Google DeepMind

ਬੇਮਿਸਾਲ ਯਥਾਰਥਵਾਦ ਅਤੇ ਭੌਤਿਕ ਸ਼ੁੱਧਤਾ ਦੇ ਨਾਲ ਗੂਗਲ ਦਾ ਨਵੀਨਤਮ ਵੀਡੀਓ ਮਾਡਲ। ਪ੍ਰੀਮੀਅਮ ਕੁਆਲਿਟੀ ਆਉਟਪੁੱਟ।

ਅਲਟਰਾ-ਰਿਅਲਿਸਟਿਕ ਭੌਤਿਕ ਤੌਰ 'ਤੇ ਸਹੀ ਗੂਗਲ ਕੁਆਲਿਟੀ 4K ਰੈਡੀ
🎨
Runway Gen4
Runway ML

Gen-2, Gen-3, ਅਤੇ Gen4 ਮਾਡਲਾਂ ਦੇ ਨਾਲ ਪ੍ਰੋਫੈਸ਼ਨਲ ਚਿੱਤਰ ਐਨੀਮੇਸ਼ਨ। ਸਿਨੇਮਾ-ਕੁਆਲਿਟੀ ਨਤੀਜੇ।

Gen-2, Gen-3, Gen4 ਚਿੱਤਰ ਐਨੀਮੇਸ਼ਨ ਸਿਨੇਮਾ ਕੁਆਲਿਟੀ ਪ੍ਰੋ ਫੀਚਰਸ
🌟
Luma Labs
Luma AI

Dream Machine ਦੇ ਨਾਲ ਕਲਾਤਮਕ ਵੀਡੀਓ ਜਨਰੇਸ਼ਨ। ਵਿਲੱਖਣ ਸੁਹਜ ਦੇ ਨਾਲ ਅਸਲੀ ਅਤੇ ਰਚਨਾਤਮਕ ਵੀਡੀਓ ਬਣਾਓ।

Dream Machine ਕਲਾਤਮਕ ਸ਼ੈਲੀ ਰਚਨਾਤਮਕ 5 ਸੈਕਿੰਡ
💎
Seedance
ByteDance

ਮਲਟੀ-ਪਰਸਨ ਕੋਰੀਓਗ੍ਰਾਫੀ ਸਪੋਰਟ ਦੇ ਨਾਲ ਉੱਨਤ ਡਾਂਸ ਸਿੰਥੇਸਿਸ। ਰੈਫਰੈਂਸ ਫੁਟੇਜ ਤੋਂ ਸਿੰਕ੍ਰੋਨਾਈਜ਼ਡ ਡਾਂਸ ਵੀਡੀਓ ਬਣਾਓ।

ਡਾਂਸ ਸਿੰਥੇਸਿਸ ਮਲਟੀ-ਪਰਸਨ ਕੋਰੀਓਗ੍ਰਾਫੀ ਰੈਫਰੈਂਸ-ਅਧਾਰਿਤ
🎯
Wan 2.2
Wan Technology

ਸਥਿਰ 5-ਸੈਕਿੰਡ ਕਲਿੱਪਾਂ ਵਿੱਚ ਮਾਹਰ। ਭਰੋਸੇਯੋਗ ਕੁਆਲਿਟੀ ਆਉਟਪੁੱਟ ਦੇ ਨਾਲ 480p ਅਤੇ 1080p ਰੈਜ਼ੋਲਿਊਸ਼ਨ ਵਿੱਚ ਉਪਲਬਧ।

v2.2 5 ਸੈਕਿੰਡ 480p/1080p ਸਥਿਰ ਆਉਟਪੁੱਟ
🛍️
Vidu
Vidu AI

ਈ-ਕਾਮਰਸ ਕੇਂਦਰਿਤ ਵੀਡੀਓ ਜਨਰੇਸ਼ਨ। ਪ੍ਰੋਡਕਟ ਸ਼ੋਅਕੇਸ ਅਤੇ ਮਾਰਕੀਟਿੰਗ ਕੰਟੈਂਟ ਲਈ ਅਨੁਕੂਲਿਤ।

ਈ-ਕਾਮਰਸ ਪ੍ਰੋਡਕਟ ਵੀਡੀਓ 8 ਸੈਕਿੰਡ ਮਾਰਕੀਟਿੰਗ ਲਈ ਤਿਆਰ

ਟੈਕਸਟ-ਟੂ-ਚਿੱਤਰ APIs

ਸਟੇਟ-ਆਫ-ਦ-ਆਰਟ ਡਿਫਿਊਜ਼ਨ ਮਾਡਲਾਂ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਟੈਕਸਟ ਵੇਰਵਿਆਂ ਤੋਂ ਸ਼ਾਨਦਾਰ ਚਿੱਤਰ ਬਣਾਓ

🎨
Google Imagen 3
Google AI

Google's most advanced image model with photorealistic quality and exceptional prompt adherence. Multiple sub-models available.

Photorealistic Large/Medium Fast turbo High resolution
Flux Dev
Black Forest Labs

ਤੇਜ਼ੀ ਨਾਲ ਕੰਮ ਕਰਨ ਲਈ ਫਾਸਟ ਡਿਵੈਲਪਮੈਂਟ ਮਾਡਲ। ਪ੍ਰੋਟੋਟਾਈਪਿੰਗ ਲਈ ਸਪੀਡ ਅਤੇ ਕੁਆਲਿਟੀ ਵਿਚਕਾਰ ਸੰਪੂਰਨ ਸੰਤੁਲਨ।

ਤੇਜ਼ ਜਨਰੇਸ਼ਨ ਡਿਵੈਲਪਮੈਂਟ 50 ਕ੍ਰੈਡਿਟ ਸਾਰੇ ਅਨੁਪਾਤ
💎
Flux Pro
Black Forest Labs

ਵਧੇਰੇ ਵੇਰਵਿਆਂ ਅਤੇ ਕਲਾਤਮਕ ਨਿਯੰਤਰਣ ਦੇ ਨਾਲ ਪ੍ਰੋਫੈਸ਼ਨਲ ਚਿੱਤਰ ਜਨਰੇਸ਼ਨ। ਉੱਤਮ ਸਥਿਰਤਾ।

ਪ੍ਰੋਫੈਸ਼ਨਲ ਉੱਚ ਕੁਆਲਿਟੀ 100 ਕ੍ਰੈਡਿਟ ਵਧਿਆ ਹੋਇਆ ਕੰਟਰੋਲ
🚀
Flux Pro 1.1
Black Forest Labs

Enhanced version with improved prompt understanding and faster generation times. Better composition.

Version 1.1 250 credits Faster Improved
👑
Flux Pro 1.1 Ultra
Black Forest Labs

ਅਧਿਕਤਮ ਕੁਆਲਿਟੀ ਚਿੱਤਰ ਜਨਰੇਸ਼ਨ। ਮੰਗ ਵਾਲੇ ਪ੍ਰੋਜੈਕਟਾਂ ਲਈ ਬਹੁਤ ਜ਼ਿਆਦਾ ਵੇਰਵੇ ਅਤੇ ਰੈਜ਼ੋਲਿਊਸ਼ਨ।

ਅਲਟਰਾ ਕੁਆਲਿਟੀ 4K ਆਉਟਪੁੱਟ 200 ਕ੍ਰੈਡਿਟ ਅਧਿਕਤਮ ਵੇਰਵੇ
🎯
Flux Kontext
Kontext AI

Specialized for context-aware generation with Pro and Max modes. Excellent for specific style requirements.

Pro/Max modes Context-aware Style control Reference support
Flux Krea
Krea AI

ਤੇਜ਼ ਜਨਰੇਸ਼ਨ ਲਈ ਕਈ ਕੁਆਲਿਟੀ ਪੱਧਰਾਂ ਦੇ ਨਾਲ ਅਨੁਕੂਲਿਤ Flux ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ।

ਕਈ ਪੱਧਰ ਤੇਜ਼ ਜਨਰੇਸ਼ਨ ਅਨੁਕੂਲਿਤ ਪਰਿਵਰਤਨਸ਼ੀਲ ਕੀਮਤ
🖼️
Minimax Image
Minimax

ਸ਼ਾਨਦਾਰ ਕਲਾਤਮਕ ਸਮਝ ਅਤੇ ਸ਼ੈਲੀ ਨਿਯੰਤਰਣ ਦੇ ਨਾਲ ਉੱਨਤ ਚੀਨੀ ਚਿੱਤਰ ਮਾਡਲ।

ਕਲਾਤਮਕ ਸ਼ੈਲੀਆਂ ਚੀਨੀ ਅਨੁਕੂਲਿਤ ਉੱਚ ਕੁਆਲਿਟੀ ਬੈਚ ਸਪੋਰਟ
🎨
Stable Diffusion
Stability AI

ਵਿਆਪਕ ਕਸਟਮਾਈਜ਼ੇਸ਼ਨ ਵਿਕਲਪਾਂ ਦੇ ਨਾਲ ਇੰਡਸਟਰੀ ਸਟੈਂਡਰਡ ਓਪਨ-ਸੋਰਸ ਮਾਡਲ।

ਓਪਨ ਸੋਰਸ ਕਸਟਮਾਈਜ਼ੇਬਲ ControlNet LoRA ਸਪੋਰਟ

ਚਿੱਤਰ-ਟੂ-ਵੀਡੀਓ APIs

ਇੰਟੈਲੀਜੈਂਟ ਮੋਸ਼ਨ ਅਤੇ ਐਨੀਮੇਸ਼ਨ ਨਾਲ ਸਥਿਰ ਚਿੱਤਰਾਂ ਵਿੱਚ ਜਾਨ ਪਾਓ

🎬
Kling Animation
Kuaishou

Transform images into smooth videos with natural motion. Multiple versions and quality modes available.

Image-to-video 5-10 seconds Natural motion Pro mode
🎥
Runway Animation
Runway ML

Professional image animation with Gen-2, Gen-3, and Gen4 models. Cinema-quality results.

Gen2/3/4 Cinema quality 16:9/9:16 Pro tools

ਅਵਤਾਰ, ਲਿਪ ਸਿੰਕ ਅਤੇ TTS APIs

ਬੋਲਣ ਵਾਲੇ ਅਵਤਾਰ ਬਣਾਓ ਅਤੇ ਪਰਫੈਕਟ ਸਿੰਕ੍ਰੋਨਾਈਜ਼ੇਸ਼ਨ ਦੇ ਨਾਲ ਕੁਦਰਤੀ ਆਵਾਜ਼ ਤਿਆਰ ਕਰੋ

👄
Hedra Lip Sync
Hedra AI

ਪਰਫੈਕਟ ਆਡੀਓ ਸਿੰਕ ਦੇ ਨਾਲ ਚਰਿੱਤਰ ਐਨੀਮੇਸ਼ਨ। ਕੁਦਰਤੀ ਹਾਵ-ਭਾਵਾਂ ਅਤੇ ਹਰਕਤਾਂ ਨਾਲ ਪੋਰਟਰੇਟਸ ਵਿੱਚ ਜਾਨ ਪਾਓ।

ਚਰਿੱਤਰ ਐਨੀਮੇਸ਼ਨ ਆਡੀਓ ਸਿੰਕ ਪੋਰਟਰੇਟਸ ਐਕਸਪ੍ਰੈਸ਼ਨ ਕੰਟਰੋਲ
🎙️
ElevenLabs TTS
ElevenLabs

ਭਾਵਨਾਤਮਕ ਨਿਯੰਤਰਣ ਅਤੇ ਕਈ ਭਾਸ਼ਾਵਾਂ ਦੇ ਨਾਲ ਸਭ ਤੋਂ ਕੁਦਰਤੀ AI ਆਵਾਜ਼ਾਂ।

ਕੁਦਰਤੀ ਆਵਾਜ਼ਾਂ ਭਾਵਨਾਤਮਕ ਕੰਟਰੋਲ 29 ਭਾਸ਼ਾਵਾਂ ਵੌਇਸ ਕਲੋਨਿੰਗ
🔊
Google TTS
Google Cloud

Google's neural text-to-speech with WaveNet voices. Over 380 voices in 50+ languages with SSML support.

380+ voices 50+ languages WaveNet SSML

ਇੱਕ API, ਬੇਅੰਤ ਸੰਭਾਵਨਾਵਾਂ

🎯 ਯੂਨੀਵਰਸਲ ਜਨਰੇਸ਼ਨ

ਸਾਰੀਆਂ ਕੰਟੈਂਟ ਕਿਸਮਾਂ - ਵੀਡੀਓ, ਚਿੱਤਰ, ਆਡੀਓ, ਅਵਤਾਰ ਲਈ ਸਿੰਗਲ 'generate' ਮੈਥਡ। ਇੱਕ ਇਕਸਾਰ API ਨਾਲ ਆਪਣੇ ਇੰਟੀਗ੍ਰੇਸ਼ਨ ਨੂੰ ਸਰਲ ਬਣਾਓ।

🤖 ਸਮਾਰਟ ਪ੍ਰੋਵਾਈਡਰ ਚੋਣ

ਸਾਡੇ AI ਨੂੰ ਤੁਹਾਡੀਆਂ ਜ਼ਰੂਰਤਾਂ ਦੇ ਅਧਾਰ 'ਤੇ ਸਭ ਤੋਂ ਵਧੀਆ ਪ੍ਰੋਵਾਈਡਰ ਚੁਣਨ ਦਿਓ, ਜਾਂ ਪੂਰੇ ਕੰਟਰੋਲ ਲਈ ਆਪਣਾ ਪਸੰਦੀਦਾ ਪ੍ਰੋਵਾਈਡਰ ਚੁਣੋ।

🔄 ਆਈਡੈਂਪੋਟੈਂਟ ਰਿਕਵੈਸਟਾਂ

Idempotency-Key ਹੈਡਰਸ ਦੇ ਨਾਲ ਸੁਰੱਖਿਅਤ ਰੀਟ੍ਰਾਈ। ਨੈੱਟਵਰਕ ਸਮੱਸਿਆਵਾਂ ਕਾਰਨ ਡੁਪਲੀਕੇਟ ਚਾਰਜਿਜ਼ ਦੀ ਚਿੰਤਾ ਕਦੇ ਨਾ ਕਰੋ।

📊 ਸਮਾਰਟ ਰੇਟ ਲਿਮਿਟਿੰਗ

ਸਪਸ਼ਟ ਰੇਟ ਲਿਮਿਟ ਹੈਡਰਸ (X-RateLimit-*) ਤੁਹਾਨੂੰ ਰਿਕਵੈਸਟ ਟਾਈਮਿੰਗ ਨੂੰ ਬਿਹਤਰ ਬਣਾਉਣ ਅਤੇ 429 ਐਰਰਸ ਤੋਂ ਬਚਣ ਵਿੱਚ ਮਦਦ ਕਰਦੇ ਹਨ।

🔔 ਸੁਰੱਖਿਅਤ ਵੈਬਹੁੱਕਸ

ਸੁਰੱਖਿਅਤ ਅਸਿੰਕ ਨੋਟੀਫਿਕੇਸ਼ਨਾਂ ਲਈ HMAC-ਸਾਈਨਡ ਵੈਬਹੁੱਕਸ। ਜਦੋਂ ਤੁਹਾਡਾ ਕੰਟੈਂਟ ਤਿਆਰ ਹੋ ਜਾਵੇ ਤਾਂ ਨੋਟੀਫਿਕੇਸ਼ਨ ਪ੍ਰਾਪਤ ਕਰੋ।

⚡ ਸਪਸ਼ਟ ਐਰਰ ਕੋਡ

INSUFFICIENT_CREDITS ਅਤੇ RATE_LIMIT ਵਰਗੇ ਮਸ਼ੀਨ-ਰੀਡੇਬਲ ਐਰਰ ਕੋਡ ਡੀਬੱਗਿੰਗ ਨੂੰ ਆਸਾਨ ਬਣਾਉਂਦੇ ਹਨ।

ਆਮ ਐਰਰ ਕੋਡ

ਕੋਡ ਵੇਰਵਾ ਕਾਰਵਾਈ
INSUFFICIENT_CREDITS ਇਸ ਕਾਰਵਾਈ ਲਈ ਕਾਫ਼ੀ ਕ੍ਰੈਡਿਟ ਨਹੀਂ ਹਨ ਆਪਣੇ ਖਾਤੇ ਦੇ ਕ੍ਰੈਡਿਟ ਟਾਪ-ਅੱਪ ਕਰੋ
RATE_LIMIT ਬਹੁਤ ਜ਼ਿਆਦਾ ਰਿਕਵੈਸਟਾਂ X-RateLimit-Reset ਹੈਡਰ ਚੈੱਕ ਕਰੋ
INVALID_INPUT ਗਲਤ ਪੈਰਾਮੀਟਰ ਦਿੱਤੇ ਗਏ ਹਨ ਸਕੀਮਾ ਦੇ ਅਨੁਸਾਰ ਇਨਪੁਟ ਚੈੱਕ ਕਰੋ
PROVIDER_UNAVAILABLE ਚੁਣਿਆ ਗਿਆ ਪ੍ਰੋਵਾਈਡਰ ਅਸਥਾਈ ਤੌਰ 'ਤੇ ਉਪਲਬਧ ਨਹੀਂ ਹੈ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ ਜਾਂ ਆਟੋ-ਸਿਲੈਕਟ ਨੂੰ ਚੁਣਨ ਦਿਓ
GENERATION_FAILED ਕੰਟੈਂਟ ਜਨਰੇਸ਼ਨ ਅਸਫਲ ਰਹੀ ਵੱਖ-ਵੱਖ ਪੈਰਾਮੀਟਰਾਂ ਨਾਲ ਦੁਬਾਰਾ ਕੋਸ਼ਿਸ਼ ਕਰੋ

ਪਲਾਨ ਅਨੁਸਾਰ ਰੇਟ ਲਿਮਿਟ

ਪਲਾਨ ਰਿਕਵੈਸਟਾਂ/ਮਿੰਟ ਕੰਕਰੈਂਟ ਰੋਜ਼ਾਨਾ ਸੀਮਾ
Free 10 1 100
Starter 30 3 1,000
Pro 60 10 10,000
Enterprise Custom Custom Unlimited

ਕੁਇੱਕ ਸਟਾਰਟ ਕੋਡ ਉਦਾਹਰਣਾਂ

# Universal generation API - Video example
curl -X POST https://api.doitong.com/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: unique-request-id-123" \
  -d '{
    "query": "mutation Generate($input: GenerateInput!) { generate(input: $input) { id status type provider url metadata { duration resolution } creditCost estimatedTime } }",
    "variables": {
      "input": {
        "type": "VIDEO",
        "provider": "minimax",
        "input": {
          "text": "A serene mountain landscape at sunset"
        },
        "options": {
          "duration": 10,
          "resolution": "1080p",
          "style": "cinematic"
        }
      }
    }
  }'

# Auto-select best provider for quality
curl -X POST https://api.doitong.com/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation { generate(input: { type: VIDEO, input: { text: \"Epic dragon battle\" }, priority: QUALITY }) { id status provider creditCost } }"
  }'

# Check generation status
curl -X POST https://api.doitong.com/graphql \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query { generation(id: \"gen_abc123\") { status progress url error { code message } } }"
  }'
// Doitong Universal API Client
class DoitongAPI {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.endpoint = 'https://api.doitong.com/graphql';
  }

  async generate(input) {
    const response = await fetch(this.endpoint, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json',
        'Idempotency-Key': crypto.randomUUID()
      },
      body: JSON.stringify({
        query: `
          mutation Generate($input: GenerateInput!) {
            generate(input: $input) {
              id
              status
              type
              provider
              url
              metadata
              creditCost
              estimatedTime
              error {
                code
                message
              }
            }
          }
        `,
        variables: { input }
      })
    });

    const data = await response.json();
    
    // Check for rate limits
    const remaining = response.headers.get('X-RateLimit-Remaining');
    if (remaining && parseInt(remaining) < 10) {
      console.warn(`Low rate limit: ${remaining} requests remaining`);
    }
    
    if (data.errors) {
      throw new Error(data.errors[0].message);
    }
    
    return data.data.generate;
  }

  async checkStatus(id) {
    const response = await fetch(this.endpoint, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        query: `
          query GetGeneration($id: ID!) {
            generation(id: $id) {
              id
              status
              progress
              url
              error {
                code
                message
              }
            }
          }
        `,
        variables: { id }
      })
    });
    
    const data = await response.json();
    return data.data.generation;
  }

  async waitForCompletion(id, pollInterval = 2000) {
    while (true) {
      const result = await this.checkStatus(id);
      
      if (result.status === 'COMPLETED') {
        return result;
      } else if (result.status === 'FAILED') {
        throw new Error(result.error?.message || 'Generation failed');
      }
      
      await new Promise(resolve => setTimeout(resolve, pollInterval));
    }
  }
}

// Usage examples
const api = new DoitongAPI('YOUR_API_KEY');

// Simple video generation - let AI choose provider
const video = await api.generate({
  type: 'VIDEO',
  input: { text: 'A serene mountain landscape' }
});

// Specific provider with options
const video = await api.generate({
  type: 'VIDEO',
  provider: 'minimax',
  input: { text: 'Epic battle scene' },
  options: {
    duration: 10,
    resolution: '1080p',
    style: 'cinematic'
  }
});

// Image generation with auto-provider selection for quality
const image = await api.generate({
  type: 'IMAGE',
  input: { text: 'Photorealistic portrait' },
  priority: 'QUALITY'
});

// Wait for completion
const result = await api.waitForCompletion(video.id);
console.log('Video ready:', result.url);

// Using Apollo Client for GraphQL
import { ApolloClient, gql } from '@apollo/client';

const CREATE_VIDEO = gql`
  mutation CreateVideo($input: VideoCreateInput!) {
    videoCreate(input: $input) {
      id
      status
      videoUrl
    }
  }
`;

const client = new ApolloClient({
  uri: 'https://api.doitong.com/graphql',
  headers: {
    authorization: 'Bearer YOUR_API_KEY'
  }
});

const result = await client.mutate({
  mutation: CREATE_VIDEO,
  variables: {
    input: {
      prompt: 'Beautiful sunset over ocean',
      model: 'luma',
      duration: 9
    }
  }
});
import requests
import time
import json
import uuid
from typing import Dict, Optional, Any

class DoitongAPI:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = "https://api.doitong.com/graphql"
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }
    
    def generate(self, 
                 content_type: str,
                 input_data: Dict[str, Any],
                 provider: Optional[str] = None,
                 options: Optional[Dict] = None,
                 idempotency_key: Optional[str] = None) -> Dict:
        """Universal generation method for all content types"""
        
        # Add idempotency key for safe retries
        headers = self.headers.copy()
        if idempotency_key:
            headers["Idempotency-Key"] = idempotency_key
        else:
            headers["Idempotency-Key"] = str(uuid.uuid4())
        
        query = """
        mutation Generate($input: GenerateInput!) {
          generate(input: $input) {
            id
            status
            type
            provider
            url
            metadata
            creditCost
            estimatedTime
            error
            errorCode
          }
        }
        """
        
        variables = {
            "input": {
                "type": content_type.upper(),
                "input": input_data
            }
        }
        
        if provider:
            variables["input"]["provider"] = provider
        if options:
            variables["input"]["options"] = options
        
        response = requests.post(
            self.base_url,
            headers=headers,
            json={"query": query, "variables": variables}
        )
        
        # Handle rate limiting
        if response.status_code == 429:
            retry_after = response.headers.get("X-RateLimit-Reset", 60)
            raise Exception(f"Rate limited. Retry after {retry_after} seconds")
        
        data = response.json()
        
        if "errors" in data:
            error = data["errors"][0]
            raise Exception(f"API Error: {error.get('message', 'Unknown error')}")
        
        return data["data"]["generate"]
    
    def check_status(self, generation_id: str) -> Dict:
        """Check the status of a generation"""
        query = """
        query GetGeneration($id: ID!) {
          generation(id: $id) {
            id
            status
            type
            url
            progress
            error
            errorCode
            metadata
          }
        }
        """
        
        response = requests.post(
            self.base_url,
            headers=self.headers,
            json={
                "query": query,
                "variables": {"id": generation_id}
            }
        )
        
        return response.json()["data"]["generation"]
    
    def wait_for_completion(self, generation_id: str, max_wait: int = 300) -> Dict:
        """Poll until generation is complete"""
        start_time = time.time()
        
        while time.time() - start_time < max_wait:
            result = self.check_status(generation_id)
            
            if result["status"] == "completed":
                return result
            elif result["status"] == "failed":
                error_code = result.get("errorCode", "UNKNOWN_ERROR")
                error_msg = result.get("error", "Generation failed")
                raise Exception(f"[{error_code}] {error_msg}")
            
            # Adaptive polling - start fast, slow down over time
            wait_time = 2 if time.time() - start_time < 30 else 5
            time.sleep(wait_time)
        
        raise TimeoutError("Generation timed out")

# Example usage
if __name__ == "__main__":
    api = DoitongAPI("YOUR_API_KEY")
    
    try:
        # Generate a video (auto-selects best provider)
        video = api.generate(
            content_type="video",
            input_data={"text": "A majestic eagle soaring through clouds"},
            options={"duration": 10, "resolution": "1080p"}
        )
        print(f"Video generation started: {video['id']}")
        
        # Wait for completion
        result = api.wait_for_completion(video['id'])
        print(f"Video ready: {result['url']}")
        print(f"Credits used: {result['creditCost']}")
        
        # Generate with specific provider
        image = api.generate(
            content_type="image",
            provider="flux-ultra",
            input_data={"text": "Professional product photography"},
            options={"aspectRatio": "16:9", "quality": "ultra"}
        )
        
        # Generate audio/TTS
        audio = api.generate(
            content_type="audio",
            provider="elevenlabs",
            input_data={"text": "Welcome to the future of AI"},
            options={"voice": "rachel", "emotion": "excited"}
        )
        
    except Exception as e:
        print(f"Error: {e}")
# Universal generation mutation - works for all content types
mutation Generate($input: GenerateInput!) {
  generate(input: $input) {
    id
    status
    type
    provider
    url
    metadata
    creditCost
    estimatedTime
    progress
    error
    errorCode
  }
}

# Example: Generate video (auto-select provider)
# Variables:
{
  "input": {
    "type": "VIDEO",
    "input": {
      "text": "A bustling Tokyo street at night with neon lights"
    },
    "options": {
      "duration": 10,
      "resolution": "1080p",
      "style": "cinematic"
    }
  }
}

# Example: Generate video with specific provider
# Variables:
{
  "input": {
    "type": "VIDEO",
    "provider": "kling",
    "input": {
      "text": "Epic space battle scene"
    },
    "options": {
      "mode": "pro",
      "duration": 10,
      "aspectRatio": "16:9"
    }
  }
}

# Example: Image-to-video generation
# Variables:
{
  "input": {
    "type": "VIDEO",
    "provider": "runway",
    "input": {
      "text": "Make the character dance",
      "image": "https://example.com/character.jpg"
    },
    "options": {
      "motionIntensity": "high",
      "model": "gen-3"
    }
  }
}

# Example: Generate image
# Variables:
{
  "input": {
    "type": "IMAGE",
    "provider": "flux-ultra",
    "input": {
      "text": "Photorealistic portrait in Rembrandt style"
    },
    "options": {
      "aspectRatio": "16:9",
      "quality": "ultra",
      "seed": 42
    }
  }
}

# Example: Generate audio/TTS
# Variables:
{
  "input": {
    "type": "AUDIO",
    "provider": "elevenlabs",
    "input": {
      "text": "Welcome to the future of artificial intelligence"
    },
    "options": {
      "voice": "rachel",
      "emotion": "excited",
      "speed": 1.0
    }
  }
}

# Example: Generate avatar video
# Variables:
{
  "input": {
    "type": "AVATAR",
    "provider": "heygen",
    "input": {
      "text": "Hello, I'm your AI assistant",
      "voice": "professional_female"
    },
    "options": {
      "avatarId": "kate",
      "background": "modern_office",
      "gesture": "friendly"
    },
    "webhookUrl": "https://your-app.com/webhook"
  }
}

# Query generation status
query GetGeneration($id: ID!) {
  generation(id: $id) {
    id
    status
    type
    provider
    url
    progress
    metadata {
      width
      height
      duration
      format
    }
    creditCost
    error
    errorCode
    createdAt
    completedAt
  }
}

# Cancel a generation
mutation CancelGeneration($id: ID!) {
  cancelGeneration(id: $id)
}

# Get available providers for a content type
query GetProviders($type: GenerationType!) {
  providers(type: $type) {
    id
    name
    description
    features
    limitations
    pricing {
      creditCost
      estimatedTime
    }
    options {
      name
      type
      required
      description
      allowedValues
    }
  }
}
}

ਕੁਝ ਸ਼ਾਨਦਾਰ ਬਣਾਉਣ ਲਈ ਤਿਆਰ ਹੋ?

ਅਗਲੀ ਪੀੜ੍ਹੀ ਦਾ AI ਕੰਟੈਂਟ ਬਣਾਉਣ ਲਈ ਸਾਡੇ API ਦੀ ਵਰਤੋਂ ਕਰਨ ਵਾਲੇ ਹਜ਼ਾਰਾਂ ਡਿਵੈਲਪਰਾਂ ਵਿੱਚ ਸ਼ਾਮਲ ਹੋਵੋ