Skip to main content
GET
/
v1
/
reports
/
fortunes
운세 통계 조회
curl --request GET \
  --url https://sajuapi.dev/v1/reports/fortunes \
  --header 'X-API-Key: <api-key>'

Documentation Index

Fetch the complete documentation index at: https://docs.sajuapi.dev/llms.txt

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

v1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다. 현재는 v0 API를 사용하세요.
운세 생성 관련 통계를 조회합니다. 모델별 사용량, 캐시 히트율, 평균 점수 등을 확인할 수 있습니다.

Query 파라미터

start_date
string
조회 시작 날짜입니다. ISO 8601 형식(YYYY-MM-DD)입니다. 기본값은 30일 전입니다.
end_date
string
조회 종료 날짜입니다. ISO 8601 형식(YYYY-MM-DD)입니다. 기본값은 오늘입니다.
fortune_type
string
특정 운세 유형만 조회합니다. daily, yearly, monthly 중 하나입니다.

Response

성공

운세 통계 조회에 성공하면 FortuneReport 객체가 반환됩니다.

실패

상태 코드에러 타입설명
401authentication_errorAPI 키가 유효하지 않음
429rate_limited요청 한도 초과

요청 예시

curl -X GET "https://api.sajuapi.dev/v1/reports/fortunes?start_date=2025-01-01&end_date=2025-01-16" \
  -H "X-API-Key: bs_live_xxx"

응답 예시

{
  "start_date": "2025-01-01",
  "end_date": "2025-01-16",
  "summary": {
    "total_fortunes": 12580,
    "unique_profiles": 3420,
    "cache_hit_rate": 72.5,
    "average_score": 73.2,
    "average_latency_ms": 1850,
    "total_cost_usd": 8.45
  },
  "by_type": {
    "daily": {
      "count": 10250,
      "percentage": 81.5,
      "average_score": 72.8,
      "cache_hit_rate": 78.2
    },
    "yearly": {
      "count": 1850,
      "percentage": 14.7,
      "average_score": 74.5,
      "cache_hit_rate": 45.3
    },
    "monthly": {
      "count": 480,
      "percentage": 3.8,
      "average_score": 75.1,
      "cache_hit_rate": 52.1
    }
  },
  "by_model": {
    "haiku": {
      "count": 9500,
      "percentage": 75.5,
      "average_latency_ms": 1200,
      "cost_usd": 2.85
    },
    "sonnet": {
      "count": 2580,
      "percentage": 20.5,
      "average_latency_ms": 2800,
      "cost_usd": 4.64
    },
    "gpt4o": {
      "count": 500,
      "percentage": 4.0,
      "average_latency_ms": 3500,
      "cost_usd": 0.96
    }
  },
  "score_distribution": {
    "0-20": 245,
    "21-40": 890,
    "41-60": 3250,
    "61-80": 5420,
    "81-100": 2775
  },
  "category_averages": {
    "overall": 73.2,
    "wealth": 68.5,
    "love": 75.8,
    "health": 71.2,
    "career": 74.9
  },
  "daily_trend": [
    {
      "date": "2025-01-01",
      "count": 780,
      "average_score": 72.5
    },
    {
      "date": "2025-01-02",
      "count": 820,
      "average_score": 73.1
    }
  ]
}

FortuneReport 객체

필드타입설명
summaryobject전체 요약 통계입니다.
by_typeobject운세 유형별 통계입니다.
by_modelobjectAI 모델별 통계입니다.
score_distributionobject점수 분포입니다.
category_averagesobject카테고리별 평균 점수입니다.
daily_trendarray일별 추이입니다.

캐시 히트율 최적화

캐시 히트율을 높이면 비용을 절감하고 응답 속도를 개선할 수 있습니다.
  • 동일한 조건 사용: profile_id, fortune_type, fortune_date, model 조합이 동일하면 캐시가 적용됩니다.
  • 배치 생성 활용: 자정에 배치 API로 미리 생성하면 사용자 요청 시 캐시된 결과를 반환합니다.
  • 오늘의 운세 API 사용: 오늘의 운세 엔드포인트는 자동으로 캐시를 활용합니다.