> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling으로 이미지 인식하기

> CometAPI POST /kling/v1/videos/image-recognize를 사용해 이미지에 대해 Kling Image Recognize를 실행하고 비디오 생성 워크플로를 위한 인식 결과를 반환합니다.

이 엔드포인트를 사용하면 어떤 후속 워크플로를 사용할지 결정하기 전에 Kling의 이미지 인식 검사를 실행할 수 있습니다.

## 반환 내용

* 이 경로는 동기식이며 인식 플래그를 직접 반환합니다
* 현재 결과는 이미지에 `head_seg`, `face_seg`, `cloth_seg`, `object_seg` 같은 영역이 포함되어 있는지를 나타냅니다
* 이 플래그를 사용해 소스 이미지가 아바타, 가상 피팅, 또는 기타 에셋 기반 워크플로에 적합한지 판단할 수 있습니다

<Tip>
  전체 파라미터 참조는 [Kling 공식 문서](https://app.klingai.com/global/dev/document-api/apiReference/model/imageRecognize)를 참고하세요.
</Tip>


## OpenAPI

````yaml api/openapi/video/kling/post-image-recognize.openapi.json POST /kling/v1/videos/image-recognize
openapi: 3.1.0
info:
  title: Image Recognize API
  version: 1.0.0
  description: >-
    Run Kling image-recognition checks and receive recognition flags
    synchronously.
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /kling/v1/videos/image-recognize:
    post:
      summary: Run Kling image recognition
      description: >-
        Submit one image and receive recognition flags such as head, face,
        cloth, or object segmentation presence.
      operationId: image_recognize
      parameters:
        - name: Content-Type
          in: header
          required: false
          description: Optional content type header.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >-
                    Image to analyze. Accepts an image URL or raw Base64 string
                    (no `data:` prefix). Supported formats: JPG, JPEG, PNG. Max
                    10 MB, minimum 300 px per side, aspect ratio between 1:2.5
                    and 2.5:1.
              default:
                image: https://your-image-host/portrait.jpg
            examples:
              Example 1:
                summary: Example 1
                value:
                  image: https://your-image-host/portrait.jpg
      responses:
        '200':
          description: Recognition result.
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - message
                  - data
                properties:
                  code:
                    type: integer
                  message:
                    type: string
                  request_id:
                    type: string
                  data:
                    type: object
                    required:
                      - task_result
                    properties:
                      task_result:
                        type: object
                        required:
                          - images
                        properties:
                          images:
                            type: array
                            items:
                              type: object
                              properties:
                                type:
                                  type: string
                                is_contain:
                                  type: boolean
                example:
                  code: 0
                  message: SUCCEED
                  data:
                    task_result:
                      images:
                        - type: head_seg
                          is_contain: true
                        - type: face_seg
                          is_contain: true
                        - type: cloth_seg
                          is_contain: true
                        - type: object_seg
                          is_contain: true
      x-codeSamples:
        - lang: Shell
          label: Default
          source: |
            curl https://api.cometapi.com/kling/v1/videos/image-recognize \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                  "image": "https://your-image-host/portrait.jpg"
                }'
        - lang: Python
          label: Default
          source: >
            import os

            import requests


            response = requests.post(
                "https://api.cometapi.com/kling/v1/videos/image-recognize",
                headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
                json={
                        "image": "https://your-image-host/portrait.jpg"
                },
            )


            result = response.json()

            print(result["code"], result.get("data", {}).get("task_id"))  # the
            route responds with the result payload directly
        - lang: JavaScript
          label: Default
          source: >
            const response = await
            fetch("https://api.cometapi.com/kling/v1/videos/image-recognize", {
                method: "POST",
                headers: {
                    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
                    "Content-Type": "application/json",
                },
                body: JSON.stringify({
                        "image": "https://your-image-host/portrait.jpg"
                    }),
            });


            const result = await response.json();

            console.log(result.code, result.data?.task_id); // the route
            responds with the result payload directly
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````