### GET /unified-video/models Source: https://midsync.dev/zh-TW/developers/docs/video-models-api 取得影片模型的 runtime metadata,包含可用模型清單、欄位定義、選項與限制。 ```APIDOC ## GET /unified-video/models ### Description 取得影片模型的 runtime metadata,讓前端知道有哪些模型、欄位、選項與限制可以安全渲染。此 API 應作為影片表單渲染前的 source of truth。 ### Method GET ### Endpoint /unified-video/models ### Parameters #### Auth - **Authorization** (header) - Required - 使用產品登入狀態,或 Bearer ### Response #### Success Response (200) - **models** (array) - 可用的影片模型清單 - **modelParams** (object) - 欄位定義、可選 enum、預設值與模型限制 - **pricingHints** (object) - 目前價格提示或價格範例 ### Request Example ```javascript const models = await fetch("/unified-video/models", { credentials: "include" }).then((resp) => resp.json()); ``` ``` -------------------------------- ### GET /v1/usage/logs Source: https://midsync.dev/zh-TW/developers/docs/usage-logs-api Retrieves detailed usage logs, suitable for generating billing tables and detail pages. Requires 'api.read' permission. ```APIDOC ## GET /v1/usage/logs ### Description Retrieves granular usage history, ideal for detailed billing tables and historical tracking. This endpoint is designed for scenarios where clients need to trace every expenditure. ### Method GET ### Endpoint /v1/usage/logs ### Parameters #### Query Parameters - **page** (integer) - Optional - Used for pagination if supported by the backend. - **limit** (integer) - Optional - Used for pagination if supported by the backend. - **date_range** (string) - Optional - Specifies the historical date range for the logs (e.g., 'last_7_days', '2023-01-01_2023-12-31'). - **model** (string) - Optional - Filters logs for a specific model if supported by the backend. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **logs** (array) - An array of usage log objects. - **model** (string) - The model used for this request. - **pointsCharged** (integer) - The number of points deducted for this request. - **usage** (object) - Contains token or other usage information if relevant. - **createdAt** (string) - The timestamp when the request was created. #### Response Example ```json { "logs": [ { "model": "grok-video", "pointsCharged": 100, "usage": { "duration": 10, "resolution": "720p" }, "createdAt": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### GET /v1/usage/summary Source: https://midsync.dev/zh-TW/developers/docs/usage-summary-api Retrieves aggregated usage data, suitable for dashboard and billing summary cards. ```APIDOC ## GET /v1/usage/summary ### Description This API is suitable for high-level summary cards. It complements the usage logs API by providing an overview, while the logs API offers detailed breakdowns. ### Method GET ### Endpoint /v1/usage/summary ### Parameters #### Query Parameters - **date_range** (string) - Optional - Specifies the summary period if supported by the backend. - **groupBy** (string) - Optional - Aggregates data by dimensions such as models, if supported by the backend. ### Response #### Success Response (200) - **totalPointsCharged** (integer) - Total points charged within the specified period. - **totalRequests** (integer) - Total requests made within the specified period. - **totalInputTokens** (integer) - Total input tokens within the specified period, if applicable. - **totalOutputTokens** (integer) - Total output tokens within the specified period, if applicable. - **byModel** (object) - Summary data for each model. - **model_name** (object) - Details for a specific model. - **pointsCharged** (integer) - Points charged for this model. - **requests** (integer) - Requests made for this model. - **inputTokens** (integer) - Input tokens for this model, if applicable. - **outputTokens** (integer) - Output tokens for this model, if applicable. ### Request Example ```json { "example": "GET /v1/usage/summary?date_range=last_7_days&groupBy=model" } ``` ### Response Example ```json { "totalPointsCharged": 15000, "totalRequests": 1000, "totalInputTokens": 500000, "totalOutputTokens": 750000, "byModel": { "gpt-4": { "pointsCharged": 10000, "requests": 600, "inputTokens": 300000, "outputTokens": 450000 }, "gpt-3.5-turbo": { "pointsCharged": 5000, "requests": 400, "inputTokens": 200000, "outputTokens": 300000 } } } ``` ``` -------------------------------- ### Get Video Quote Estimate Source: https://midsync.dev/zh-TW/developers/docs/video-quote-api Use this snippet to make a POST request to the /unified-video/quote endpoint to obtain an estimated point cost for video generation. Ensure the request body matches the /generate endpoint's requirements. Re-quote if model, duration, resolution, quality, audio, or mode changes. ```javascript const quote = await fetch("/unified-video/quote", { method: "POST", credentials: "include", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ model: "seedance-1.5-pro", prompt: "一隻狗在明亮攝影棚裡奔跑的電影感鏡頭", duration: 8, resolution: "720p" }) }).then((resp) => resp.json()); ``` -------------------------------- ### Fetch Video Models Metadata Source: https://midsync.dev/zh-TW/developers/docs/video-models-api Call this API before rendering video forms to get a source of truth for available models, field enums, default values, and constraints. Ensure credentials are included for authentication. ```typescript const models = await fetch("/unified-video/models", { credentials: "include" }).then((resp) => resp.json()); ``` -------------------------------- ### GET /unified-video/:taskId/status Source: https://midsync.dev/zh-TW/developers/docs/video-status-api Retrieves the current status of a video generation task using the taskId. ```APIDOC ## GET /unified-video/:taskId/status ### Description Retrieves the current status of a video generation task. This endpoint is intended for manual queries, fallback checks, or recovery processes rather than continuous polling. ### Method GET ### Endpoint /unified-video/:taskId/status ### Parameters #### Path Parameters - **taskId** (string) - Required - The unique identifier of the task returned from the /unified-video/generate endpoint. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the query was successful. - **taskId** (string) - The ID of the queried task. - **status** (string) - The current status of the task. - **output / assets** (object) - The generated result if the task is completed. - **error** (string) - Error information if the task failed. ``` -------------------------------- ### Create Video Generation Task Source: https://midsync.dev/zh-TW/developers/docs/video-generate-api Use this cURL command to send a POST request to the /unified-video/generate endpoint to create a video generation task. Ensure you replace `` with your actual API key. The request body specifies the model, prompt, duration, and resolution for the video. ```bash curl --request POST \ --url https://api-dev.midsync.ai/unified-video/generate \ --header "Authorization: Bearer " \ --header "Content-Type: application/json" \ --data '{ \ "model": "seedance-1.5-pro", \ "prompt": "黃昏海邊的電影感鏡頭,海浪輕拍岸邊", \ "duration": 8, \ "resolution": "720p" \ }' ``` -------------------------------- ### POST /unified-video/generate Source: https://midsync.dev/zh-TW/developers/docs/model-runway Generates a video using the Runway model based on text prompts or image inputs. ```APIDOC ## POST /unified-video/generate ### Description Generates a video using the Runway model. Supports text-to-video and image-to-video generation. ### Method POST ### Endpoint /unified-video/generate ### Parameters #### Request Body - **model** (string) - Required - Must be set to "runway". - **prompt** (string) - Required - Description of the video content. - **images** (array) - Optional - Maximum 1 image for image-guided generation. - **aspectRatio** (string) - Optional - Required if no image is provided. - **duration** (integer) - Optional - Video length in seconds. - **quality** (string) - Optional - Output quality (e.g., 720p, 1080p). - **watermark** (boolean) - Optional - Toggle for video watermark. - **projectId** (string) - Optional - Internal tracking ID. ### Request Example { "model": "runway", "prompt": "A cinematic shot of a mountain landscape", "aspectRatio": "16:9", "duration": 5, "quality": "720p" } ``` -------------------------------- ### POST /unified-video/generate Source: https://midsync.dev/zh-TW/developers/docs/model-kling-25 Endpoint to trigger video generation using the Kling 2.5 Turbo model. ```APIDOC ## POST /unified-video/generate ### Description Generates a video based on text prompts or image inputs using the kling-2.5-turbo model. ### Method POST ### Endpoint /unified-video/generate ### Parameters #### Request Body - **model** (string) - Required - Must be "kling-2.5-turbo". - **prompt** (string) - Required - Description of the video content. - **images** (array) - Optional - List of image URLs (max 2) for image-to-video generation. - **aspectRatio** (string) - Optional - Output aspect ratio (e.g., "16:9", "9:16"). - **duration** (integer) - Optional - Video duration in seconds (5 or 10). - **negativePrompt** (string) - Optional - Content to avoid in the video. - **cfgScale** (float) - Optional - Adherence to prompt (0 to 1). - **projectId** (string) - Optional - Internal tracking ID. ### Request Example { "model": "kling-2.5-turbo", "prompt": "A cinematic shot of a futuristic city", "duration": 5, "aspectRatio": "16:9" } ``` -------------------------------- ### POST /unified-video/generate Source: https://midsync.dev/zh-TW/developers/docs/video-generate-api Creates a video generation task after client acceptance of settings and pricing. This endpoint is suitable for teams implementing a submission flow, task creation, success status tracking, and final point deduction. ```APIDOC ## POST /unified-video/generate ### Description Creates a video generation task. This endpoint should be used after a client has accepted the settings and pricing. It is designed for teams that need to implement a submission flow, task creation, track success status, and manage final point deductions. The primary method for receiving completion results is via callback. ### Method POST ### Endpoint https://api-dev.midsync.ai/unified-video/generate ### Parameters #### Request Body - **model** (string) - Required - The ID of the selected video model. - **prompt** (string) - Required - The main generation prompt. - **duration** (integer) - Optional (may be required depending on the model) - The desired duration of the video. - **resolution** (string) - Optional (may be required depending on the model) - The desired resolution of the video (e.g., "720p"). - **quality** (string) - Optional - Used by quality grading models. - **aspectRatio** (string) - Optional - Must be an aspect ratio supported by the model. - **mode** (string) - Optional - Used for multi-mode models. - **generateAudio** (boolean) - Optional - Send only if the model supports audio generation. - **images** (array of strings) - Optional - Provide image URLs for image-to-video models. - **referenceVideoUrls** (array of strings) - Optional - Provide URLs for reference videos if the model supports it. ### Request Example ```json { "model": "seedance-1.5-pro", "prompt": "黃昏海邊的電影感鏡頭,海浪輕拍岸邊", "duration": 8, "resolution": "720p" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the task creation was successful. - **taskId** (string) - The internal task ID, used for subsequent status checks. - **providerTaskId** (string) - The task ID from the upstream provider. - **model** (string) - The ID of the model used for generation. - **providerModel** (string) - The actual model name used by the provider. - **pointsCharged** (integer) - The number of points actually deducted for this generation. - **status** (string) - The initial status of the task (e.g., "submitted"). - **estimatedTime** (string) / **estimatedTimeSec** (integer) - Estimated processing time, if provided by the backend. #### Response Example ```json { "success": true, "taskId": "task_12345abc", "providerTaskId": "provider_xyz789", "model": "seedance-1.5-pro", "providerModel": "sdxl-video-v1", "pointsCharged": 10, "status": "submitted", "estimatedTimeSec": 120 } ``` ### Frontend Usage Notes - Disable the primary button upon submission. - Display `pointsCharged` directly after successful creation. - The primary completion flow should be handled via callback. The `/unified-video/:taskId/status` endpoint should be considered a fallback, manual query, or recovery mechanism. ``` -------------------------------- ### Sample Request Body for Price Estimation Source: https://midsync.dev/zh-TW/pricing-estimator A JSON object representing the configuration for a video generation request. This structure dynamically updates based on user-selected parameters. ```json { "model": "seedance-1.5-pro", "prompt": "黃昏海邊的電影感鏡頭,光線柔和,海浪慢慢推進", "duration": 8, "resolution": "720p", "aspectRatio": "16:9" } ``` -------------------------------- ### POST /unified-video/quote Source: https://midsync.dev/zh-TW/developers/docs/video-quote-api Estimates the point cost for a video generation request based on the provided parameters. ```APIDOC ## POST /unified-video/quote ### Description Pre-calculates the point cost for a video generation request. The request body should match the structure used for the generation endpoint. ### Method POST ### Endpoint /unified-video/quote ### Parameters #### Request Body - **model** (string) - Required - Video model ID (e.g., seedance-1.5-pro) - **prompt** (string) - Required - Main generation prompt - **duration** (number) - Required (model dependent) - Video duration - **resolution** (string) - Required (model dependent) - Video resolution - **quality** (string) - Optional - Model-specific quality setting - **aspectRatio** (string) - Optional - Supported aspect ratio - **mode** (string) - Optional - Model mode - **generateAudio** (boolean) - Optional - Whether to include audio pricing - **images** (array) - Optional - Array of image URLs for image-to-video - **referenceVideoUrls** (array) - Optional - Array of reference video URLs ### Request Example { "model": "seedance-1.5-pro", "prompt": "一隻狗在明亮攝影棚裡奔跑的電影感鏡頭", "duration": 8, "resolution": "720p" } ### Response #### Success Response (200) - **success** (boolean) - Whether the estimation was successful - **model** (string) - The model ID used for estimation - **pointsCharged** (number) - Estimated point cost - **error** (string) - Error message if the combination is invalid ``` -------------------------------- ### Kling 2.6 T2V Generation Source: https://midsync.dev/zh-TW/developers/docs/model-kling-26-t2v Endpoint documentation for generating videos from text using the kling-2.6-t2v model. ```APIDOC ## POST /unified-video/generate ### Description Generates a video based on a text prompt using the Kling 2.6 T2V model. This endpoint requires the 'api.generate' permission. ### Method POST ### Endpoint /unified-video/generate ### Parameters #### Request Body - **model** (string) - Required - Must be 'kling-2.6-t2v'. - **prompt** (string) - Required - Description of video content, action, style, and camera movement. - **aspectRatio** (string) - Optional - Controls output aspect ratio. - **duration** (integer) - Optional - Video length in seconds (supports 5 or 10). - **generateAudio** (boolean) - Optional - Whether to generate audio. Enabling this increases the cost. - **negativePrompt** (string) - Optional - Features to exclude from the video. - **cfgScale** (float) - Optional - Adherence to prompt (0.0 to 1.0). - **cameraControl.cameraMotion** (string) - Optional - Camera movement type (e.g., pan, tilt, zoom). - **cameraControl.cameraSpeed** (float) - Optional - Camera speed (0.1 to 2.0). - **projectId** (string) - Optional - Internal tracking ID. ### Request Example { "model": "kling-2.6-t2v", "prompt": "A cinematic shot of a futuristic city", "duration": 5, "generateAudio": false, "cfgScale": 0.5 } ### Response #### Success Response (200) - **status** (string) - Generation status. - **jobId** (string) - Unique identifier for the generation task. ``` -------------------------------- ### 影音生成任務請求範例 Source: https://midsync.dev/zh-TW/developers/docs/video-status-api 用於發起影音生成任務的 JSON 請求格式。 ```json { "model": "hailuo-2.3-standard", "prompt": "讓人像照片產生自然的呼吸與眨眼動作", "images": [ "https://example.com/portrait.png" ], "duration": 10, "resolution": "768P" } ``` -------------------------------- ### Kling 3.0 Model Configuration Source: https://midsync.dev/zh-TW/developers/docs/model-kling-30 Details on parameters and rules for the Kling 3.0 model generation. ```APIDOC ## POST /unified-video/generate ### Description Generates video content using the Kling 3.0 model. Supports both single-shot and multi-shot modes. ### Method POST ### Endpoint /unified-video/generate ### Request Body - **model** (string) - Required - Must be "kling-3.0" - **prompt** (string) - Required (if single-shot) - Main prompt for single-shot mode - **images** (array) - Optional - Reference images - **aspectRatio** (string) - Optional - "16:9", "9:16", or "1:1" - **duration** (integer) - Optional - Video length - **generateAudio** (boolean) - Optional - Whether to generate audio - **mode** (string) - Optional - "std" or "pro" - **multiShots** (boolean) - Optional - Set to true for multi-shot mode - **multiPrompt** (array) - Optional - Required if multiShots is true. Contains prompt and duration (1-12) for each shot - **klingElements** (array) - Optional - Element references (max 3 groups, 2-4 images per group) - **projectId** (string) - Optional - Internal tracking ID ### Request Example { "model": "kling-3.0", "prompt": "A cinematic shot of a futuristic city", "mode": "std", "aspectRatio": "16:9" } ``` -------------------------------- ### seedance-1.5-pro Video Generation API Source: https://midsync.dev/zh-TW/developers/docs/model-seedance-15 This API endpoint allows for video generation using the seedance-1.5-pro model. It supports both text-to-video and image-to-video generation with various customization options. ```APIDOC ## POST /unified-video/generate ### Description Generates video content using the seedance-1.5-pro model. Supports text-to-video and image-to-video generation. ### Method POST ### Endpoint /unified-video/generate ### Parameters #### Request Body - **model** (string) - Required - Specifies the video model to use. Must be 'seedance-1.5-pro'. - **prompt** (string) - Required - The main text prompt describing the desired video content, scene, style, and action. - **images** (array[string]) - Optional - An array of image URLs (0 to 2) to guide video generation. 0 images for text-to-video, 1-2 images for image-guided video. - **aspectRatio** (string) - Optional - The desired aspect ratio of the output video (e.g., '16:9', '9:16'). Supported values: '1:1', '4:3', '3:4', '16:9', '9:16', '21:9', '2:3', '3:2'. - **resolution** (string) - Optional - The desired resolution of the output video. Supported values: '480p', '720p', '1080p'. - **duration** (integer) - Optional - The desired duration of the video in seconds. Supported values: 4, 8, 12. - **generateAudio** (boolean) - Optional - Whether to generate audio along with the video. Defaults to false. Enabling this may affect pricing. - **fixedLens** (boolean) - Optional - Whether to maintain a more fixed camera lens effect. Use only when necessary. - **nsfwChecker** (boolean) - Optional - Whether to enable content safety checks. This is a platform control field. - **projectId** (string) - Optional - An internal tracking field for accounting, querying, or project data integration. ### Request Example ```json { "model": "seedance-1.5-pro", "prompt": "A majestic dragon flying over a medieval castle at sunset, cinematic style.", "aspectRatio": "16:9", "resolution": "1080p", "duration": 12, "generateAudio": true } ``` ### Response #### Success Response (200) - **videoId** (string) - The unique identifier for the generated video. - **status** (string) - The current status of the video generation process. #### Response Example ```json { "videoId": "vid_abc123xyz", "status": "processing" } ``` ``` -------------------------------- ### 呼叫用量紀錄 API 請求範例 Source: https://midsync.dev/zh-TW/developers/docs/usage-logs-api 此 JSON 範例展示了請求模型生成任務時的參數結構,包含模型選擇、提示詞與解析度設定。 ```json { "model": "grok-video", "prompt": "一隻金毛犬在明亮攝影棚中向鏡頭跑來", "duration": 10, "resolution": "720p", "aspectRatio": "16:9" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.