Hedra कैरेक्टर एनिमेशन
परफेक्ट ऑडियो सिंक के साथ कैरेक्टर एनिमेशन। नेचुरल एक्सप्रेशन और मूवमेंट के साथ पोर्ट्रेट्स में जान फूंकें।
✓ Character animation
✓ Audio sync
✓ Portraits
✓ Expression control
प्रमाणीकरण
Doitong API के माध्यम से Hedra को एक्सेस करने के लिए, अपनी Doitong API key का उपयोग करें। इसे GraphQL mutation या REST API headers में शामिल करें।
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
क्विक स्टार्ट
बस कुछ ही मिनटों में Hedra Lip Sync API के साथ शुरुआत करें। अपना पहला avatar जेनरेट करने के लिए इन सरल चरणों का पालन करें।
चरण 1: अपनी API Key प्राप्त करें
Doitong अकाउंट के लिए साइन अप करें और API key जेनरेट करने के लिए अपने डैशबोर्ड पर जाएं।
चरण 2: अपनी पहली रिक्वेस्ट भेजें
अपनी पहली API कॉल करने के लिए नीचे दिए गए कोड उदाहरणों में से किसी एक का उपयोग करें।
curl -X POST https://api.doitong.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"query": "mutation Generate($input: GenerateInput!) { generate(input: $input) { id status type provider url metadata creditCost } }",
"variables": {
"input": {
"type": "AVATAR",
"provider": "hedra",
"input": {
"text": "Hello, welcome to our platform!",
"avatarId": "professional-1"
},
"options": {
"voice": "en-US-neural"
}
}
}
}'
const response = await fetch('https://api.doitong.com/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
query: `
mutation GenerateAvatar($input: AvatarGenerationInput!) {
generateAvatar(input: $input) {
id
status
videoUrl
}
}
`,
variables: {
input: {
service: 'hedra',
text: 'Hello, welcome to our platform!',
avatarId: 'professional-1',
voice: 'en-US-neural'
}
}
})
});
const data = await response.json();
console.log('Avatar Video:', data.data.generateAvatar);
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": "AVATAR",
"provider": "hedra",
"input": {
"text": "Hello, welcome to our platform!",
"avatarId": "professional-1"
},
"options": {
"voice": "en-US-neural"
}
}
}
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": "AVATAR",
"provider": "hedra",
"input": {
"text": "Hello, welcome to our platform!",
"avatarId": "professional-1"
},
"options": {
"voice": "en-US-neural",
"language": "en",
"version": "hedra-1.0"
}
}
}
प्राइसिंग
Hedra Lip Sync API क्रेडिट-आधारित प्राइसिंग मॉडल का उपयोग करता है। जेनरेट किए गए कंटेंट की जटिलता और अवधि के आधार पर क्रेडिट खर्च होते हैं।
| फीचर | क्रेडिट | विवरण |
|---|---|---|
| छोटा वीडियो | 50-100 क्रेडिट | 30 सेकंड तक |
| लंबा वीडियो | 200-500 क्रेडिट | 30 सेकंड से 2 मिनट तक |
API एंडपॉइंट्स
Hedra Lip Sync API हमारे एकीकृत GraphQL एंडपॉइंट के माध्यम से उपलब्ध है।
GraphQL एंडपॉइंट
POST https://api.doitong.com/graphql
REST एंडपॉइंट
POST https://api.doitong.com/v1/avatar
पैरामीटर्स
Hedra Lip Sync API रिक्वेस्ट के लिए उपलब्ध पैरामीटर्स:
| पैरामीटर | प्रकार | अनिवार्य | विवरण |
|---|---|---|---|
service |
String | Yes | सर्विस आइडेंटिफ़ायर: "hedra" |
version |
String | No | Model version: "hedra-1.0" |
webhookUrl |
String | No | जनरेशन पूरा होने के नोटिफिकेशन प्राप्त करने के लिए URL |
रिस्पॉन्स फॉर्मेट
सभी API रिस्पॉन्स एक सुसंगत फॉर्मेट का पालन करते हैं:
सफलता रिस्पॉन्स
{
"data": {
"avatar": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
पूर्ण रिस्पॉन्स
{
"data": {
"avatar": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp3",
"duration": null,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
एरर हैंडलिंग
API मानक HTTP स्टेटस कोड का उपयोग करता है और विस्तृत एरर मैसेज देता है।
सामान्य एरर कोड
| स्टेटस कोड | एरर टाइप | विवरण |
|---|---|---|
| 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 |
एरर रिस्पॉन्स फॉर्मेट
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
वेबहुक्स
जब आपका avatar जनरेशन पूरा हो जाए, तो रीयल-टाइम नोटिफिकेशन प्राप्त करें।
वेबहुक्स सेटअप करना
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
वेबहुक पेलोड
{
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp3",
"service": "hedra",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": null,
"width": null,
"height": null
}
}
वेबहुक सुरक्षा
सभी वेबहुक रिक्वेस्ट में वेरिफिकेशन के लिए एक सिग्नेचर हेडर शामिल होता है:
X-Doitong-Signature: sha256=abc123...
रेट लिमिट्स
निष्पक्ष उपयोग और सिस्टम स्थिरता सुनिश्चित करने के लिए, निम्नलिखित रेट लिमिट्स लागू होती हैं:
| प्लान | रिक्वेस्ट/मिनट | समवर्ती जॉब्स | दैनिक सीमा |
|---|---|---|---|
| फ्री | 10 | 1 | 100 |
| स्टार्टर | 30 | 3 | 1,000 |
| प्रो | 60 | 10 | 10,000 |
| एंटरप्राइज | कस्टम | कस्टम | असीमित |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
सर्वोत्तम अभ्यास
1. अपने प्रॉम्प्ट्स को ऑप्टिमाइज़ करें
सर्वोत्तम परिणामों के लिए स्पष्ट और वर्णनात्मक प्रॉम्प्ट लिखें:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. एसिंक प्रोसेसिंग को हैंडल करें
जनरेशन एसिंक्रोनस है। उचित पोलिंग या वेबहुक लागू करें:
// 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. एरर रिकवरी
एक्सपोनेंशियल बैकऑफ़ के साथ रिट्राय लॉजिक लागू करें:
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. क्रेडिट उपयोग की निगरानी करें
रुकावटों से बचने के लिए अपने क्रेडिट खर्च को ट्रैक करें:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
क्या आप शुरू करने के लिए तैयार हैं?
बेहतरीन कंटेंट बनाने के लिए Hedra Lip Sync API का उपयोग करने वाले हज़ारों डेवलपर्स में शामिल हों