{
  "openapi": "3.1.0",
  "info": {
    "title": "Lip-Sync API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/kling/v1/videos/identify-face": {
      "post": {
        "summary": "Lip-Sync",
        "operationId": "lip_sync",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "video_id": {
                    "type": "string",
                    "description": "Kling video id from a completed task. Send either video_id or video_url."
                  },
                  "video_url": {
                    "type": "string",
                    "description": "Public MP4 or MOV URL. Send either video_id or video_url."
                  }
                },
                "default": {
                  "video_url": "https://your-video-host/source.mp4"
                },
                "oneOf": [
                  {
                    "required": [
                      "video_id"
                    ]
                  },
                  {
                    "required": [
                      "video_url"
                    ]
                  }
                ]
              },
              "examples": {
                "Default": {
                  "summary": "Identify faces from a video URL",
                  "value": {
                    "video_url": "https://your-video-host/source.mp4"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "message",
                    "request_id",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "session_id",
                        "face_data"
                      ],
                      "properties": {
                        "session_id": {
                          "type": "string"
                        },
                        "face_data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "face_id": {
                                "type": "string"
                              },
                              "face_image": {
                                "type": "string"
                              },
                              "start_time": {
                                "type": "integer"
                              },
                              "end_time": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Default",
            "source": "curl https://api.cometapi.com/kling/v1/videos/identify-face \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n      \"video_url\": \"https://your-video-host/source.mp4\"\n    }'\n"
          },
          {
            "lang": "Python",
            "label": "Default",
            "source": "import os\nimport requests\n\nresponse = requests.post(\n    \"https://api.cometapi.com/kling/v1/videos/identify-face\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]},\n    json={\n      \"video_url\": \"https://your-video-host/source.mp4\"\n    },\n)\n\nresult = response.json()\nprint(result.get(\"code\"), result.get(\"data\", {}).get(\"session_id\"))\n"
          },
          {
            "lang": "JavaScript",
            "label": "Default",
            "source": "const response = await fetch(\"https://api.cometapi.com/kling/v1/videos/identify-face\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    \"video_url\": \"https://your-video-host/source.mp4\"\n  }),\n});\n\nconst result = await response.json();\nconsole.log(result.code, result.data?.session_id);\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}
