C.W.K.
Stream
Lesson 12 of 12 · published

토큰 경제학 — 왜 가격이 토큰당이냐

~10 min · pricing, economics, inference

Level 0Token
0 XP0/94 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

모든 주요 LLM API는 토큰당 과금하고, input/output 토큰당 비용이 달라. 이거 임의가 아니야 — 공급자가 써야 하는 컴퓨트를 직접 따라가.

모델 (2026년 중반 가격)입력 ($/1M)출력 ($/1M)
GPT-4o$2.50$10.00
Gemini 2.5 Pro$1.25$10.00
Claude 3.7 Sonnet$3.00$15.00
Gemini 2.5 Flash$0.30$2.50

왜 output이 input보다 4-10배 비싸냐

input 토큰은 prefill 단계에서 병렬로 처리돼 — 전체 prompt 위에서 큰 matmul 하나. output 토큰은 순차로 생산되고, 토큰 하나당 모든 layer를 통과하는 풀 forward pass + 점점 커지는 컨텍스트 attend. 토큰당 컴퓨트는 비슷한데, 공유 하드웨어에서 토큰당 throughput은 한 자릿수 차이가 나. 그 격차가 가격에 반영된 거야.

본인 앱에 대한 함의: 긴 컨텍스트가 긴 생성보다 싸. "검색된 문서 잔뜩 넣고 짧은 답 생성"하는 RAG 스타일은 가격 유리하고, "짧은 prompt 넣고 5,000토큰 에세이 생성"은 비싼 shape. feature 설계 시 이 비대칭을 이해하면 어떤 전략이 경제적인지 바뀌어.

Code

Cost estimator — be honest before you build·python
def estimate_cost(prompt_tokens, output_tokens,
                  in_per_1m, out_per_1m):
    return prompt_tokens / 1_000_000 * in_per_1m \
         + output_tokens / 1_000_000 * out_per_1m

# Pricing (USD / 1M tokens) — update with current sheet
PRICES = {
    "gpt-4o":             (2.50, 10.00),
    "claude-3.7-sonnet":  (3.00, 15.00),
    "gemini-2.5-flash":   (0.30,  2.50),
}

# Daily budget for 100k requests, average 800-token prompt + 400-token answer
for model, (in_p, out_p) in PRICES.items():
    daily = 100_000 * estimate_cost(800, 400, in_p, out_p)
    print(f"{model:>22}  ${daily:>9,.2f}/day")

External links

Exercise

본인 코드베이스에서 LLM 부르는 feature 하나 골라. 실제 요청 100건의 (prompt, completion) 토큰 수 로깅. 세 모델(프론티어 하나, 중급 하나, 저가 하나)에서 요청당 실제 비용 계산. 큰 모델이 품질 vs. 비용에서 이기는 지점은? 그 우위가 그만한 가치가 있나?

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.