Skip to content

feat: LLM API 키 사용량 조회 추가 - #50

Merged
yessjun merged 1 commit into
mainfrom
feat/llm-usage-trend
Aug 11, 2026
Merged

feat: LLM API 키 사용량 조회 추가#50
yessjun merged 1 commit into
mainfrom
feat/llm-usage-trend

Conversation

@yessjun

@yessjun yessjun commented Aug 11, 2026

Copy link
Copy Markdown
Member

📝 작업내용

  • LLM API 키의 일별 사용량 조회 추가
    • 게이트웨이가 보낸 이벤트가 쌓이기만 하고 되읽는 경로가 없었음, 학생이 자기 사용량을 볼 방법이 없던 상태
    • 하루는 한국 시간 달력 날짜, 호출이 없던 날도 0으로 채움
    • 버킷은 요청이 일어난 시각 기준, 도착 시각이 아님. 전송이 배치라 자정을 걸친 호출이 나중 호출보다 늦게 도착함
    • 보고 시각은 가장 최근 도착분, 가장 최근 요청 시각이 아님. 아직 오는 중인 배치에는 이미 저장된 것보다 오래된 호출이 들어 있음
    • 한도에 걸린 요청을 다른 실패와 따로 셈, 사용자가 할 수 있는 일이 있는 유일한 실패
    • 토큰 수가 추정인 요청 수도 따로 셈, 일부가 추정인 합계가 실측처럼 읽히지 않도록
  • API 명세 v0.41.0, 권한 매트릭스 158행

⭐️ 검증

  • 검증 스크립트 통과
  • 스코핑 스위트에 등재, 다섯 처지를 순회
  • 수기 마스터 대조를 실제로 실행해 경로와 이름 전부 일치 확인

💬 리뷰 포인트

  • 사용량은 상시권이 아니라 내용, 부여 없는 워크스페이스 소유자는 상세와 같은 이유로 거부됨
  • 키가 풀리지 않은 이벤트는 아무 계열에도 넣지 않음, 남의 실패가 이 키 차트에 섞이면 안 되므로

Usage events have been landing since the gateway switched to the control
plane, and nothing read them back out: the rows existed but no student
could see what their own key had done.

Days are KST calendar days and the series is gapless -- a day nobody
called is a zero row. A hole in a chart reads as "no data reached us",
which is a different and more alarming claim than "nobody called".

Buckets follow requested_at, never arrival. Shipping is batched and
at-least-once, so a call that straddles midnight arrives after calls that
happened later, and bucketing by arrival would file it under the wrong
day. reportedUntil is the newest arrival rather than the newest request
time, because a batch still in flight holds calls older than one already
stored.

Rate-limited requests are counted apart from other failures: they are the
one signal that says when to ask for a higher limit. Estimated token
counts are counted too, so a total that is partly a guess does not read
as measured.

Usage is content, not standing -- a workspace owner without a grant is
refused here exactly as at the key's detail.
@yessjun
yessjun merged commit 1fe6176 into main Aug 11, 2026
1 check passed
@yessjun
yessjun deleted the feat/llm-usage-trend branch August 11, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant