BazaarLinkBazaarLink
로그인
문서API 레퍼런스SDK 레퍼런스에이전트 사용법AI 스킬
계정

사용량 조회

지정된 기간의 지출/요청 수/토큰 합계를 모델별, API 키별, 앱 이름별 세 가지 차원으로 나누어 반환하고, 일별 시계열도 포함합니다. /v1/insights와 달리 이 엔드포인트에는 상위 모델 순위, 캐시 통계, 연간 히트맵이 없습니다 — 더 가벼운 집계 엔드포인트이며 사용자 지정 날짜 범위(period=custom)를 지원합니다.

GET/api/v1/usage

인증

Authorization필수
string · header

Authorization 헤더에 Bearer 토큰으로 API 키를 전달합니다.

쿼리 파라미터

period
string

시간 범위, 기본값은 month. 세 가지 종류: 레거시 달력 용어(day/week/month/year), 현재를 끝점으로 하는 롤링 윈도우(15m…1y), 달력 정렬 윈도우(today…prev_year), 또는 custom(from/to 필요). 인식할 수 없는 값은 400을 반환합니다.

dayweekmonthyear15m30m1h3h1d2d1w1mo1ytodayyesterdaythis_weekprev_weekthis_monthprev_monththis_yearprev_yearcustom
Example: "month"
from
string

사용자 지정 기간의 시작(ISO 8601). period=custom일 때만 사용됩니다.

ISO 8601, required with period=custom
Example: "2026-07-01T00:00:00.000Z"
to
string

사용자 지정 기간의 끝(ISO 8601). period=custom일 때만 사용됩니다.

ISO 8601, required with period=custom
Example: "2026-07-27T00:00:00.000Z"
GET /api/v1/usage
curl "https://bazaarlink.ai/api/v1/usage?period=month" \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY"
응답 예시

성공. totals는 기간 합계입니다. byModel/byKey/byApp은 서로 독립적인 세 가지 분류입니다(중첩 관계 아님). timeSeries는 모델별로 구분된 일별 지출/토큰/요청 수 시리즈입니다. 아래 예시는 축약되었습니다.

{
  "period": "month",
  "since": "2026-07-01T00:00:00.000Z",
  "until": "2026-07-27T12:00:00.000Z",
  "credits": 42.5,
  "totals": {
    "spend": 4.82,
    "requests": 340,
    "tokens": 152000,
    "promptTokens": 120000,
    "completionTokens": 32000
  },
  "byModel": [
    {
      "model": "openai/gpt-4.1",
      "spend": 4.82,
      "tokens": 152000,
      "requests": 340
    }
  ],
  "byKey": [
    {
      "keyId": "key_abc123",
      "keyName": "default",
      "spend": 4.82,
      "tokens": 152000,
      "requests": 340,
      "spendLimitUsd": null,
      "spendLimitPeriod": null
    }
  ],
  "byApp": [
    {
      "appName": "my-app",
      "spend": 4.82,
      "tokens": 152000,
      "requests": 340
    }
  ],
  "timeSeries": [
    {
      "date": "2026-07-01",
      "model": "openai/gpt-4.1",
      "cost": 0.16,
      "tokens": 5200,
      "requests": 12
    }
  ]
}
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
사용량 조회 — BazaarLink API