메인 콘텐츠로 건너뛰기

Documentation Index

Fetch the complete documentation index at: https://docs.lemondata.cc/llms.txt

Use this file to discover all available pages before exploring further.

개요

비디오, 이미지, 음악, 3D 생성과 같은 작업 유형 전반에서 통합된 비동기 polling을 위해 이 엔드포인트를 사용하세요. create 응답에 poll_url이 포함되어 있으면 해당 정확한 path를 호출하세요. 최신 비동기 워크플로에서는 poll_url/v1/tasks/{taskId}를 가리킬 수 있습니다.

경로 매개변수

taskId
string
필수
create 요청에서 반환된 작업 ID입니다.

응답

id
string
작업 식별자입니다.
status
string
작업 상태입니다. 예: pending, processing, completed, failed. 취소된 작업은 failedcancelled: true로 표시됩니다.
cancelled
boolean
대기 중인 비동기 작업이 실행 전에 취소되면 true입니다.
cancellation_status
string
취소 마커입니다. 취소 성공 시 cancelled입니다.
data
array
완료된 이미지 작업의 경우 생성된 이미지 결과가 여기에 반환됩니다. 이미지 작업은 data[].url에 URL을 반환합니다.
video_url
string
작업이 완료되어 비디오를 생성한 경우의 결과 asset URL입니다.
error
string
작업이 실패했을 때의 오류 메시지입니다.

오류 동작

작업이 더 이상 존재하지 않거나, 만료되었거나, 공개 async-task 계약을 통해 더 이상 확인할 수 없는 경우 LemonData는 다음을 반환합니다.
{
  "error": {
    "message": "Task not found or no longer available.",
    "type": "invalid_request_error",
    "code": "async_task_not_found"
  }
}

예제

curl "https://api.lemondata.cc/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" \
  -H "Authorization: Bearer sk-your-api-key"
Python
import requests

poll_url = "/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
response = requests.get(
    f"https://api.lemondata.cc{poll_url}",
    headers={"Authorization": "Bearer sk-your-api-key"},
)
print(response.json())
JavaScript
const pollUrl = '/v1/tasks/ldtask_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
const response = await fetch(`https://api.lemondata.cc${pollUrl}`, {
  headers: { Authorization: 'Bearer sk-your-api-key' },
});
console.log(await response.json());