AI Cost Economics
AIHiểu và optimize cost LLM: token pricing, caching, model routing, fine-tune vs prompt.
Đăng nhập để đánh dấu kỹ năng và theo dõi tiến độ.
Roadmap — Cách học và đạt kỹ năng
Token pricing 101
LLM API tính tiền theo input + output token. 1 token ≈ 4 chars English, ≈ 2.5 chars Vietnamese (vì diacritic).
Ví dụ pricing (Q1 2026)
| Model | Input $/M token | Output $/M token |
|---|---|---|
| GPT-4o | $2.50 | $10.00 |
| GPT-4o mini | $0.15 | $0.60 |
| Claude Opus | $15.00 | $75.00 |
| Claude Sonnet | $3.00 | $15.00 |
| Claude Haiku | $0.80 | $4.00 |
Unit economics PM phải biết
- Cost per call — phụ thuộc prompt length + completion length.
- Cost per user/month — # calls × cost/call.
- Margin — ARPU − AI cost − infra − support.
Sample calculation
App chatbot: user trung bình 20 message/tháng, mỗi message 2k input + 500 output token, dùng GPT-4o. Cost = 20 × (2k × $2.5/M + 500 × $10/M) = 20 × ($0.005 + $0.005) = $0.20/user/month. Nếu sub là $5/month, margin AI ~96%.
Optimization techniques
- Prompt caching — cache system prompt + few-shot, OpenAI/Anthropic discount 50–90%.
- Model routing — small model cho easy query, big model cho complex.
- Output capping — max_tokens limit để tránh runaway.
- Batch API — 50% discount nếu non-realtime.
- Embeddings cache — reuse embedding cho user query repeat.
- Compression — shorten prompt bằng abbreviation + structure.
- Fine-tune — task narrow, volume cao có thể profitable.
Vietnam context
VND/USD exchange + VAT làm consumer AI feature VN khó margin tốt. Nhiều startup VN dùng VinAI PhoGPT hoặc open-source local (Llama 3, Qwen) để tránh token cost USD.
Common pitfalls
- Không monitor cost daily → bill spike sau viral moment.
- Default max_tokens too high → 90% call dùng <500 token nhưng cap 4k.
- Skip caching analysis → leave 50% saving.
- Over-engineer fine-tune cho task <1M call/tháng.
Thảo luận & tài liệu thêm 0
Chia sẻ kinh nghiệm, đặt câu hỏi, hoặc đính kèm tài liệu/YouTube giúp người khác học kỹ năng này.