Hedra Charakter-Animation
Charakter-Animation mit perfekter Audiosynchronisation. Erwecken Sie Porträts mit natürlichen Ausdrücken zum Leben.
✓ Charakter-Animation
✓ Audio-Sync
✓ Porträts
✓ Ausdruckskontrolle
Authentifizierung
Um über die Doitong-API auf Hedra zuzugreifen, verwenden Sie Ihren Doitong-API-Schlüssel. Fügen Sie diesen in die GraphQL-Mutation oder die REST-API-Header ein.
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
Schnellstart
Starten Sie mit Hedra Lip Sync API in nur wenigen Minuten. Folgen Sie diesen einfachen Schritten, um Ihre erste avatar zu erstellen.
Schritt 1: API-Schlüssel erhalten
Registrieren Sie sich für ein Doitong-Konto und navigieren Sie zu Ihrem Dashboard, um einen API-Schlüssel zu generieren.
Schritt 2: Die erste Anfrage senden
Nutzen Sie eines der untenstehenden Code-Beispiele für Ihren ersten API-Aufruf.
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"
}
}
}
Preise
Hedra Lip Sync API nutzt ein Credit-basiertes Preismodell. Credits werden basierend auf der Komplexität und Dauer der generierten Inhalte verbraucht.
| Funktion | Credits | Beschreibung |
|---|---|---|
| Kurzes Video | 50-100 Credits | Bis zu 30 Sekunden |
| Langes Video | 200-500 Credits | 30 Sekunden bis 2 Minuten |
API-Endpunkte
Hedra Lip Sync API ist über unseren einheitlichen GraphQL-Endpunkt verfügbar.
GraphQL-Endpunkt
POST https://api.doitong.com/graphql
REST-Endpunkt
POST https://api.doitong.com/v1/avatar
Parameter
Verfügbare Parameter für Hedra Lip Sync API-Anfragen:
| Parameter | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
service |
String | Yes | Service-Identifikator: "hedra" |
version |
String | No | Model version: "hedra-1.0" |
webhookUrl |
String | No | URL für Benachrichtigungen bei Fertigstellung |
Antwortformat
Alle API-Antworten folgen einem einheitlichen Format:
Erfolgreiche Antwort
{
"data": {
"avatar": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Abgeschlossene Antwort
{
"data": {
"avatar": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp3",
"duration": null,
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
Fehlerbehandlung
Die API verwendet Standard-HTTP-Statuscodes und gibt detaillierte Fehlermeldungen zurück.
Häufige Fehlercodes
| Statuscode | Fehlertyp | Beschreibung |
|---|---|---|
| 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 |
Fehler-Antwortformat
{
"errors": [
{
"message": "Insufficient credits for this operation",
"extensions": {
"code": "INSUFFICIENT_CREDITS",
"creditsRequired": 100,
"creditsAvailable": 50
}
}
]
}
Webhooks
Erhalten Sie Echtzeit-Benachrichtigungen, sobald die Erstellung Ihrer avatar abgeschlossen ist.
Webhooks einrichten
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.mp3",
"service": "hedra",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": null,
"width": null,
"height": null
}
}
Webhook-Sicherheit
Alle Webhook-Anfragen enthalten einen Signatur-Header zur Verifizierung:
X-Doitong-Signature: sha256=abc123...
Rate Limits
Um eine faire Nutzung und Systemstabilität zu gewährleisten, gelten die folgenden Limits:
| Tarif | Anfragen/Minute | Gleichzeitige Jobs | Tageslimit |
|---|---|---|---|
| Kostenlos | 10 | 1 | 100 |
| Starter | 30 | 3 | 1,000 |
| Pro | 60 | 10 | 10,000 |
| Enterprise | Individuell | Individuell | Unbegrenzt |
X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Requests remainingX-RateLimit-Reset: Window reset timestamp
Best Practices
1. Prompts optimieren
Schreiben Sie klare, beschreibende Prompts für beste Ergebnisse:
- Be specific about visual elements, style, and mood
- Include details about lighting, camera angles, and composition
- Avoid contradictory or impossible requests
2. Asynchrone Verarbeitung handhaben
Die Generierung erfolgt asynchron. Implementieren Sie entsprechendes Polling oder 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. Fehlerbehebung
Implementieren Sie eine Retry-Logik mit exponentiellem 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. Credit-Verbrauch überwachen
Verfolgen Sie Ihren Credit-Verbrauch, um Unterbrechungen zu vermeiden:
- Check credit balance before large batch operations
- Set up alerts for low credit thresholds
- Implement credit-aware request queuing
Bereit loszulegen?
Schließen Sie sich tausenden Entwicklern an, die Hedra Lip Sync API nutzen, um großartige Inhalte zu erstellen