Skip to main content
Core.Today

API Reference

Core.Today API 전체 엔드포인트 레퍼런스

Base URLs

Image/Video:https://api.core.today/v1
LLM (OpenAI):https://api.core.today/llm/openai/v1
LLM (Anthropic):https://api.core.today/llm/anthropic/v1
LLM (Gemini):https://api.core.today/llm/gemini/v1beta

Authentication

모든 API 요청에는 인증이 필요합니다. 다음 방법 중 하나를 사용하세요:

# X-API-Key 헤더 (권장)
curl -H "X-API-Key: cdt_your_api_key" ...

# Authorization 헤더
curl -H "Authorization: Bearer cdt_your_api_key" ...

Predictions

POST/v1/predictions

AI 모델로 예측(이미지/비디오/오디오 생성) 요청을 생성합니다.

Request Body

ParameterTypeRequiredDescription
modelstringYes모델 ID (예: flux-schnell, kling-v1)
inputobjectYes모델별 입력 파라미터
is_publicbooleanNotrue면 영구 public URL 생성 (기본: false)
output_folderstringNo결과물 저장 폴더 경로
webhookstringNo완료 시 호출할 Webhook URL
webhook_eventsstring[]NoWebhook 이벤트 타입 (completed, failed)

Example Request

curl -X POST https://api.core.today/v1/predictions \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $CORE_API_KEY" \
  -d '{
    "model": "flux-schnell",
    "input": {
      "prompt": "A beautiful sunset over mountains",
      "aspect_ratio": "16:9"
    }
  }'

Response

{
  "id": "pred_abc123xyz",
  "status": "pending",
  "model": "flux-schnell",
  "input": {
    "prompt": "A beautiful sunset over mountains",
    "aspect_ratio": "16:9"
  },
  "created_at": "2024-12-28T12:00:00Z"
}
GET/v1/predictions/:id

예측 작업의 상태와 결과를 조회합니다.

Path Parameters

ParameterTypeRequiredDescription
idstringYes예측 작업 ID

Response (succeeded)

{
  "id": "pred_abc123xyz",
  "status": "succeeded",
  "model": "flux-schnell",
  "output": [
    "https://cdn.core.today/outputs/abc123/output.png"
  ],
  "metrics": {
    "total_time": 2.5,
    "queue_time": 0.1,
    "run_time": 2.4
  },
  "created_at": "2024-12-28T12:00:00Z",
  "completed_at": "2024-12-28T12:00:03Z"
}

Status Values

  • pending - 대기 중
  • processing - 처리 중
  • succeeded - 성공
  • failed - 실패
  • canceled - 취소됨
DELETE/v1/predictions/:id

진행 중인 예측 작업을 취소합니다.

Path Parameters

ParameterTypeRequiredDescription
idstringYes취소할 예측 작업 ID

Response

{
  "id": "pred_abc123xyz",
  "status": "canceled",
  "message": "Prediction canceled successfully"
}

Files

POST/v1/files/upload-url

S3 presigned upload URL을 발급받습니다.

Request Body

ParameterTypeRequiredDescription
filenamestringYes업로드할 파일 이름
content_typestringNoMIME 타입 (기본: application/octet-stream)
folderstringNo저장 폴더 경로

Example Request

curl -X POST https://api.core.today/v1/files/upload-url \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $CORE_API_KEY" \
  -d '{
    "filename": "input.jpg",
    "content_type": "image/jpeg",
    "folder": "my-project/inputs"
  }'

Response

{
  "upload_url": "https://s3.amazonaws.com/bucket/...",
  "file_url": "https://cdn.core.today/files/abc123/input.jpg",
  "expires_at": "2024-12-28T13:00:00Z"
}

파일 업로드 방법

발급받은 upload_url로 PUT 요청을 보내 파일을 업로드하세요:

curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: image/jpeg" \
  --data-binary @input.jpg
GET/v1/files

업로드한 파일 목록을 조회합니다.

Query Parameters

ParameterTypeRequiredDescription
folderstringNo폴더 경로 필터
limitintegerNo반환할 최대 개수 (기본: 20)
cursorstringNo페이지네이션 커서

Databases

POST/v1/databases

새 데이터베이스를 생성합니다.

Request Body

ParameterTypeRequiredDescription
namestringYes데이터베이스 이름
descriptionstringNo설명
schemaobjectYes필드 스키마 정의

Example Request

{
  "name": "products",
  "description": "E-commerce product catalog",
  "schema": {
    "title": { "type": "text" },
    "description": { "type": "text" },
    "price": { "type": "float" },
    "category": { "type": "keyword" },
    "embedding": { "type": "knn_vector", "dimension": 768 }
  }
}
POST/v1/databases/:uid/search

문서를 검색합니다.

Request Body

ParameterTypeRequiredDescription
queryobjectYesOpenSearch Query DSL
sizeintegerNo반환할 결과 수 (기본: 10)
fromintegerNo오프셋 (페이지네이션)

Example: 전문 검색

{
  "query": {
    "multi_match": {
      "query": "wireless headphones",
      "fields": ["title", "description"]
    }
  },
  "size": 20
}

Example: 벡터 검색 (kNN)

{
  "query": {
    "knn": {
      "embedding": {
        "vector": [0.1, 0.2, ...],
        "k": 10
      }
    }
  }
}

Error Responses

API 오류 시 다음 형식의 JSON 응답이 반환됩니다:

{
  "error": {
    "code": "insufficient_credits",
    "message": "Not enough credits. Required: 5, Available: 2",
    "details": {
      "required": 5,
      "available": 2
    }
  }
}
HTTP CodeError CodeDescription
400invalid_request잘못된 요청 형식
401unauthorizedAPI 키 없음 또는 유효하지 않음
402insufficient_credits크레딧 부족
404not_found리소스를 찾을 수 없음
429rate_limit_exceeded요청 한도 초과
500internal_error서버 내부 오류