개요/OpenAPI/빠른 시작

빠른 시작

인증하고, 첫 번째 생성을 수행하고, 해당 출력을 검색합니다.

빠른 시작

이 걷는 길은 최소한의 설명 비디오를 만듭니다. 생산 기반 URL은 다음과 같습니다 :

https://api.kpainter.ai/openapi/v1

1) API 키를 준비하십시오

활성화하고 키를 복사합니다. API 키 페이지, 그 후에 서버 측의 변수 환경에 보관합니다. 절대 브라우저 코드 또는 로그로 보내지 마십시오.

export KPAINTER_API_KEY="<your_api_key>"export KPAINTER_BASE_URL="https://api.kpainter.ai/openapi/v1"

2) 계좌 확인하기

curl -s "$KPAINTER_BASE_URL/me" \  -H "Authorization: Bearer $KPAINTER_API_KEY"

3) 현재의 능력 읽기

curl -s "$KPAINTER_BASE_URL/capabilities" \  -H "Authorization: Bearer $KPAINTER_API_KEY"

이 응답에서 길이, 음성, 템플릿 및 표현 스타일을 선택합니다. 예제 값을 영구적 인 구성으로 취급하지 마십시오.

4) 콘텐츠 만들기

curl -s "$KPAINTER_BASE_URL/creations" \  -H "Authorization: Bearer $KPAINTER_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "type": "video",    "prompt": "Explain the customer escalation process to new employees",    "instructions": "Use a concise professional tone and preserve source terminology",    "max_credits": 300,    "video": {      "duration_seconds": 120,      "aspect_ratio": "16:9",      "language": "en"    }  }'

5장 진보

창조 및 편집은 비동기입니다. 반환된 창조 ID를 유지하고 동일한 결과를 검색합니다.

import time while True:    response = requests.get(        f"{BASE_URL}/creations/{creation_id}",        headers=HEADERS,        timeout=30,    )    response.raise_for_status()    creation = response.json()     print(        creation["status"],        creation["progress_pct"],        creation.get("estimated_remaining_seconds"),        creation.get("estimated_credits"),    )     if creation["status"] in {"ready", "failed", "paused"}:        break     time.sleep(5)

6.출처 읽기

상태가 준비되었거나 has_usable_delivery가 사실인 경우에만 출력을 읽으십시오.

outputs = requests.get(    f"{BASE_URL}/creations/{creation_id}/outputs",    headers=HEADERS,    timeout=30,)outputs.raise_for_status()print(outputs.json()["outputs"])

트레이트는 권한이있는 URL을 반환했습니다. 저장 경로를 만들지 마십시오.

출처 파일 추가

각 출처를 POST /file로 업로드한 다음 input_file_ids에 파일_id를 포함합니다. 3개의 제품 모두 업로드된 파일을 받아들인다. 보기 생성 및 검색 한 가지 예를 들어.