Minimax 動画生成
高度なシーン理解と自然な動きを備えた次世代の動画生成。HailuoおよびHailuoI2Vモデルにより最高品質を実現します。
✓ 1280x720 HD生成
✓ 5秒間の動画
✓ インテリジェントなシーン理解
✓ 画像から動画(I2V)への変換対応
認証
Doitong APIを通じてMinimax/Hailuoにアクセスするには、Doitong APIキーを使用してください。GraphQLミューテーションまたはREST APIのヘッダーに含める必要があります。
// GraphQL Header
{
"Authorization": "Bearer YOUR_API_KEY"
}
// REST Header
"X-API-Key": "YOUR_API_KEY"
クイックスタート
わずか数分でMinimax / Hailuo-02 APIを使い始めることができます。以下の手順に従って、最初のtext to videoを生成しましょう。
ステップ1:APIキーの取得
Doitongアカウントを登録し、ダッシュボードからAPIキーを発行します。
ステップ2:最初のリクエストを実行
以下のコード例を使用して、最初のAPI呼び出しを行います。
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": "minimax",
"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: 'minimax',
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": "minimax",
"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": "minimax",
"input": {
"text": "A serene landscape with mountains and a lake at sunset"
},
"options": {
"duration": 5,
"aspectRatio": "16:9",
"version": "hailuo-02",
"quality": "high"
}
}
}
料金体系
Minimax / Hailuo-02 APIはクレジット制の料金モデルを採用しています。クレジットは、生成されるコンテンツの複雑さや長さに応じて消費されます。
| 機能 | クレジット | 説明 |
|---|---|---|
| 標準モード | 100-200 クレジット | 標準画質の5〜10秒の動画 |
| プロモード | 300-500 クレジット | プロ品質の5〜10秒の動画 |
APIエンドポイント
Minimax / Hailuo-02 APIは、統合されたGraphQLエンドポイントから利用可能です。
GraphQLエンドポイント
POST https://api.doitong.com/graphql
RESTエンドポイント
POST https://api.doitong.com/v1/text_to_video
パラメータ
Minimax / Hailuo-02 APIのリクエストで使用可能なパラメータ:
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
service |
文字列 | Yes | サービス識別子: "minimax" |
prompt |
文字列 | Yes | 生成内容のテキスト説明 |
duration |
整数 | No | 動画の長さ(秒単位、デフォルト:5) |
aspectRatio |
文字列 | No | アスペクト比: "16:9", "9:16", "1:1"(デフォルト:"16:9") |
version |
文字列 | No | Model version: "hailuo-02" |
webhookUrl |
文字列 | No | 完了通知を受け取るためのURL |
レスポンス形式
すべてのAPIレスポンスは、一貫した形式で返されます:
成功レスポンス
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "processing",
"url": null,
"webhookUrl": "https://your-webhook.com/callback",
"createdAt": "2024-01-01T00:00:00Z"
}
}
}
完了レスポンス
{
"data": {
"generatevideo": {
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"duration": 5,
"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
}
}
]
}
Webhook
text to videoの生成が完了した際に、リアルタイムで通知を受け取ることができます。
Webhookの設定
Include a <code>webhookUrl</code> parameter in your request to receive a POST notification when processing is complete.
Webhookペイロード
{
"id": "abc123xyz",
"status": "completed",
"url": "https://cdn.doitong.com/outputs/abc123xyz.mp4",
"service": "minimax",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:01:00Z",
"metadata": {
"duration": 5,
"width": 1920,
"height": 1080
}
}
Webhookのセキュリティ
すべてのWebhookリクエストには、検証用の署名ヘッダーが含まれています:
X-Doitong-Signature: sha256=abc123...
レート制限
公平な利用とシステムの安定性を確保するため、以下のレート制限が適用されます:
| プラン | リクエスト数/分 | 同時実行ジョブ数 | 1日あたりの制限 |
|---|---|---|---|
| 無料 | 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. 非同期処理のハンドリング
生成は非同期で行われます。適切なポーリングまたはWebhookを実装してください:
// 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
今すぐ始めましょう
数千人の開発者がMinimax / Hailuo-02 APIを使用して素晴らしいコンテンツを作成しています