Kling으로 이미지 생성하기
CometAPI를 통해 Kling으로 이미지를 생성합니다: POST /kling/v1/images/generations는 프롬프트 기반 이미지 생성과 이미지 참조 생성을 지원합니다.
이미지 생성
첫 요청
model_name: kling-v3, prompt, n, aspect_ratio부터 시작하세요. 첫 요청이 사용 가능한 작업을 반환한 뒤에만 참조 이미지, fidelity 제어 또는 고급 필드를 추가하세요. model_name을 생략하면 레거시 호환 기본값이 사용되므로, 새로운 통합에서는 kling-v3를 명시적으로 보내세요.
응답 읽기
반환된task_id를 저장한 다음, task_status가 종료 상태에 도달할 때까지 해당하는 Kling 이미지 조회 경로를 폴링하세요. 워크플로에 내구성 있는 저장소가 필요하다면, 생성이 완료된 후 최종 결과물을 자체 저장 계층으로 복사하세요.인증
Bearer token authentication. Use your CometAPI key.
헤더
Must be application/json.
본문
Text prompt describing the image to generate. Maximum 2500 characters.
Kling image model variant. Use kling-v3 for new requests. Omitting model_name uses the legacy CometAPI route default.
kling-v1, kling-v1-5, kling-v2, kling-v2-1, kling-v3 Elements to exclude from the image. Maximum 2500 characters. Not supported when image is provided.
Reference image as a raw Base64 string without a data: prefix, or a public URL. Accepted formats: JPG, JPEG, PNG. Maximum 10 MB, minimum 300x300 px, aspect ratio between 1:2.5 and 2.5:1.
Reference mode for legacy image-to-image requests when image is provided.
subject, face How closely the output follows the reference image. Range: 0-1. Used by legacy image-reference models.
0 <= x <= 1Human-subject fidelity control. Range: 0-1. Used only by legacy subject-reference requests.
0 <= x <= 1Optional Kling element references. The total count of element references and input images must not exceed 10.
Output resolution. Defaults to 1k.
1k, 2k Number of images to generate. Range: 1-9.
1 <= x <= 9Output aspect ratio (width:height).
16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9 Watermark options.
Webhook URL to receive task status updates when the task completes.
Optional user-defined task ID for your own tracking. Must be unique per account.