提示词 Token 成本

🔑 LLM Token Cost Estimator

Estimate API cost from input and output token counts and unit price, to budget a LLM feature before launch.

📐 计算公式 / 原理
输入费用 = 输入 tokens / 10⁶ × 输入单价;输出费用 = 输出 tokens / 10⁶ × 输出单价;人民币 ≈ 美元 × 汇率
大模型 API 普遍按输入与输出分别计价,且输出单价通常高于输入,因此压缩提示词与控制生成长度都能直接省钱。换算人民币时汇率按当期取值,另需考虑批量/缓存折扣与最低计费粒度。

📐 计算公式与说明

费用判读(与上式互补):单项费用=Token 数÷1,000,000×每百万单价(USD),输入、输出分开计价后相加为总费用;人民币≈总费用×7.2(页面固定汇率常数,非实时牌价)。校验:无强校验,空值按 0 兜底。判据:无固定分级,单价按 $/1M tokens 口径,token 数翻倍费用同比例翻倍。

汇率按 1 USD ≈ 7.2 CNY 估算。

📚 深度解析:提示词 Token 成本

💡 常见使用场景

成本估算
输入 10k token($0.01/1k)、输出 2k token($0.03/1k) → 费用=10×0.01+2×0.03=0.16 USD≈1.15 元。批量调用前用此预判账单。

❓ 常见问题(FAQ)

为什么不同模型费用差很多?
单价随模型能力与上下文长度差异大,且输入输出单价常不同;大上下文/强模型更贵,选型需权衡效果与成本。
估算的 token 数准吗?
不准到精确位。中文在 GPT/Claude/国产模型下 token 数差异明显,本工具给量级参考,精确计费以厂商账单为准。

Formula & Standard References

Item Formula / Note Source / Standard
Cost formula total cost is input tokens times input price plus output tokens times output price OpenAI API pricing reference
Input output price gap output tokens usually cost more than input tokens so long answers scale cost faster OpenAI API pricing reference
Billing unit prices are quoted per million tokens and must be converted to a common currency and scale ISO 4217 currency codes