Skip to main content
Core.Today

Reports & Analytics

사용량, 비용, 성능 분석 리포트를 생성하고 관리합니다. 예약 리포트와 이메일 발송도 지원합니다.

주요 기능

  • 리포트 타입: Usage, Cost, Performance, Error, Comprehensive
  • 내보내기: JSON, CSV, Excel 형식 지원
  • 예약 리포트: 일간/주간/월간 자동 생성 및 이메일 발송
  • 빠른 조회: Quick Report 엔드포인트로 간편 조회
  • 팀 지원: 팀별 리포트 생성 및 관리

리포트 타입

타입설명포함 항목
usageAPI 사용량 분석요청 수, 일별/시간별 트렌드, 모델별 분포
cost비용 분석크레딧 사용량, 프로바이더별/모델별 비용
performance성능 분석응답 시간, P50/P95/P99, 느린 요청
error에러 분석에러율, 에러 타입별 분포, 상세 내역
comprehensive종합 리포트모든 섹션 포함
1

리포트 생성

원하는 타입과 기간으로 리포트를 생성합니다. 다양한 형식으로 내보내기가 가능합니다.

curl -X POST https://api.core.today/v1/reports/generate \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "report_type": "usage",
    "days": 7,
    "format": "json",
    "save": true,
    "sections": {
      "summary": true,
      "daily_trend": true,
      "hourly_trend": false,
      "by_provider": true,
      "by_model": true,
      "by_api_key": false,
      "performance": true
    }
  }'

응답 예시 (JSON)

{
  "report_id": "rpt_abc123",
  "report_type": "usage",
  "team_id": "team_xyz",
  "generated_at": "2024-12-26T10:00:00Z",
  "period_start": "2024-12-19T00:00:00Z",
  "period_end": "2024-12-26T00:00:00Z",
  "data": {
    "summary": {
      "total_requests": 15420,
      "successful_requests": 15100,
      "failed_requests": 320,
      "total_credits_used": 4580.5
    },
    "daily_trend": [
      {"date": "2024-12-19", "requests": 2100, "credits": 630},
      {"date": "2024-12-20", "requests": 2350, "credits": 705},
      ...
    ],
    "by_provider": [
      {"provider": "replicate", "requests": 8500, "percentage": 55.1},
      {"provider": "fal", "requests": 4200, "percentage": 27.2},
      ...
    ],
    "by_model": [
      {"model": "flux-schnell", "requests": 5000, "credits": 1500},
      {"model": "stable-diffusion", "requests": 3500, "credits": 1050},
      ...
    ]
  }
}

내보내기 형식

json

구조화된 데이터

csv

스프레드시트 호환

xlsx

Excel 파일

2

빠른 리포트 (Quick Reports)

간단한 GET 요청으로 주요 리포트를 빠르게 조회합니다.

사용량 리포트

curl "https://api.core.today/v1/reports/quick/usage?days=7" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"

성능 리포트

curl "https://api.core.today/v1/reports/quick/performance?days=7" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"

팀별 리포트

curl "https://api.core.today/v1/reports/quick/usage?days=30&team_id=team_xyz" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"
3

리포트 기록

저장된 리포트를 조회하고 다운로드합니다.

리포트 목록

curl "https://api.core.today/v1/reports?limit=20" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"

응답: report_id, report_type, generated_at, period_start, period_end 포함

특정 리포트 조회

curl https://api.core.today/v1/reports/{report_id} \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"

리포트 다운로드

# CSV로 다운로드
curl "https://api.core.today/v1/reports/download/{report_id}?format=csv" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -o report.csv

# Excel로 다운로드
curl "https://api.core.today/v1/reports/download/{report_id}?format=xlsx" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -o report.xlsx

리포트 삭제

curl -X DELETE https://api.core.today/v1/reports/{report_id} \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"
4

예약 리포트

정기적으로 리포트를 생성하고 이메일로 발송합니다.

리포트 예약

curl -X POST https://api.core.today/v1/reports/schedule \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "report_type": "usage",
    "frequency": "weekly",
    "schedule_time": "09:00",
    "schedule_day": 1,
    "days": 7,
    "recipients": ["team@example.com", "manager@example.com"],
    "sections": {
      "summary": true,
      "daily_trend": true,
      "by_provider": true,
      "by_model": true
    }
  }'

발송 주기

주기schedule_day설명
daily-매일 지정된 시간에 발송
weekly0-6 (일-토)매주 지정된 요일에 발송
monthly1-31매월 지정된 날짜에 발송

예약 설정 조회

curl https://api.core.today/v1/reports/preferences/all \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"

예약 취소

curl -X DELETE https://api.core.today/v1/reports/schedule/{report_type} \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN"
5

즉시 이메일 발송

리포트를 생성하고 즉시 이메일로 발송합니다.

curl -X POST "https://api.core.today/v1/reports/send?report_type=usage&days=7" \
  -H "Authorization: Bearer YOUR_CLERK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '["recipient1@example.com", "recipient2@example.com"]'

참고: 수신자를 지정하지 않으면 로그인한 사용자의 이메일로 발송됩니다.

SDK 예제

JavaScript / TypeScript

import axios from 'axios';

const api = axios.create({
  baseURL: 'https://api.core.today/v1',
  headers: { 'Authorization': 'Bearer YOUR_CLERK_TOKEN' }
});

// 리포트 생성
const report = await api.post('/reports/generate', {
  report_type: 'usage',
  days: 7,
  format: 'json',
  save: true
});

console.log('Total requests:', report.data.data.summary.total_requests);

// 빠른 조회
const quickReport = await api.get('/reports/quick/performance?days=30');

// 예약 설정
await api.post('/reports/schedule', {
  report_type: 'comprehensive',
  frequency: 'weekly',
  schedule_time: '09:00',
  schedule_day: 1,
  recipients: ['team@example.com']
});

Python

import requests

CLERK_TOKEN = "your_clerk_token"
BASE_URL = "https://api.core.today/v1"
headers = {"Authorization": f"Bearer {CLERK_TOKEN}"}

# 리포트 생성
response = requests.post(
    f"{BASE_URL}/reports/generate",
    headers=headers,
    json={
        "report_type": "usage",
        "days": 7,
        "format": "json",
        "save": True
    }
)
report = response.json()
print(f"Total requests: {report['data']['summary']['total_requests']}")

# CSV 다운로드
csv_response = requests.get(
    f"{BASE_URL}/reports/download/{report['report_id']}?format=csv",
    headers=headers
)
with open("report.csv", "wb") as f:
    f.write(csv_response.content)

# 예약 설정
requests.post(
    f"{BASE_URL}/reports/schedule",
    headers=headers,
    json={
        "report_type": "comprehensive",
        "frequency": "weekly",
        "schedule_time": "09:00",
        "schedule_day": 1,
        "recipients": ["team@example.com"]
    }
)

섹션 설정

리포트에 포함할 섹션을 선택할 수 있습니다.

섹션기본값설명
summarytrue요약 통계 (총 요청, 성공/실패, 크레딧)
daily_trendtrue일별 트렌드 데이터
hourly_trendfalse시간별 트렌드 데이터
by_providertrue프로바이더별 분석
by_modeltrue모델별 분석
by_api_keyfalseAPI 키별 분석
performancetrue성능 지표 (응답 시간, 백분위)
slow_requestsfalse느린 요청 상세 목록
error_detailsfalse에러 상세 내역

Best Practices

  • 일일 모니터링: Quick Report를 사용하여 매일 핵심 지표를 확인하세요.
  • 주간 리포트: 팀에게 주간 종합 리포트를 예약 발송하여 트렌드를 파악하세요.
  • 비용 관리: Cost 리포트로 모델별 비용을 분석하고 최적화하세요.
  • 성능 최적화: Performance 리포트의 slow_requests 섹션으로 병목을 찾으세요.
  • 데이터 보관: 중요한 리포트는 save: true로 저장하세요.