Bỏ qua, tới nội dung chính

Kiến trúc · ADR 0049

An AI credit is priced from a cost basis: one typical tutor answer, sold at about 2.5×

Trạng thái
proposed; the credit unit is superseded by ADR-0057, which keeps the value
Ngày
2026-11-21
Người quyết định
SmartLearn team (#123)

Context

The points economy and the AI quota use placeholder numbers. gemini-3.5-flash is deprecated and Google bills it at gemini-3.6-flash rates, which double on 2027-01-01 ($1.50 / $7.50 per 1M tokens). A deterministic estimate from the real prompts puts a typical RAG tutor answer at about 357 VND at 2027 prices (124 low, 808 high).

Decision

  • 1 AI credit = one typical tutor answer, cost basis 360 VND at the planning price (2027). Credits are sold at about 2.5× the cost basis (about 900 VND). An action costs ⌈typical cost / 360 VND⌉ credits, checked so that its high scenario stays within credits × 900 VND.
  • Point packs stay as in ADR-0042 (100 / 300 / 700 points for 20k / 50k / 100k VND). The margin is computed on the cheapest pack, 142.9 VND per point.
  • Exchange: 6 points = 1 credit. One RewardItem AI_10: 60 points for 10 credits, perUserMonthlyLimit 10.
  • Free quota: students keep 50 credits a month and instructors 200. A daily cap of 15 calls is enforced.
  • Action costs: tutor 1, practice quiz of 5 questions 2, quiz draft 5 for every 10 MCQ or every 4 CODE/ESSAY questions, embedding 0. Grading feedback is 1 credit and #129 project review is 10 credits (input capped at 60k tokens, at most 2 runs per submission). Both are charged to the course budget, never to the student.
  • Points course allowance (#127): NONE, WEEKLY_10, WEEKLY_25 or DAILY_10 (fair-use cap of 70 a week), counted per ICT week. A course's pointPrice must be at least 3 points × the allowed answers over the course. Official FPT courses keep the personal quota.

Alternatives considered

  • Price at 2026 rates. Rejected: the rates double inside the project's own lifetime.
  • Credit = 1 000 tokens. Rejected: students do not reason in tokens, and the quota and the tutor already count one answer as one credit.
  • Unlimited AI inside a points course. Rejected: one heavy student would cost more than the course price. DAILY_10 is the ceiling.

Consequences

The prices hold at full use of every allowance for the typical case. A student at the worst case costs about 208k VND a month. The free quota and earned points are the only parts the platform pays for. calculateTokenCostUsd must get per-model, dated rates before the logged costUsd can be trusted. Moving the tutor to gemini-3.5-flash-lite (about 4× cheaper) would let the course rule drop to 1 point per answer. Each number is replaced by the measured value under the decision rule in the research note.