Skill 插件
在 Cursor、Claude Code 等 IDE 中直接查询 LLM 价格,让 AI 自动帮你做 API vs 本地部署的成本核算。
安装指南
只需两步,即可让你的 Cursor 拥有 TrakToken 的比价和成本核算能力:
- 在你的项目根目录下创建
.cursor/skills/traktoken/文件夹。 - 在该文件夹下新建一个名为
SKILL.md的文件,并将下方的内容复制进去。
--- name: traktoken-query description: Query LLM API prices, compare token costs, and calculate local vs API deployment ROI from TrakToken. Use when the user asks about LLM pricing, token costs, or local vs API comparisons. --- # TrakToken Query Skill ## Instructions When the user asks about LLM API prices, token costs, or wants to compare local deployment vs API costs, follow these steps: 1. **Fetch Latest Pricing Data**: Use the `WebFetch` tool or `Shell` tool (with `curl`) to fetch the latest pricing data from TrakToken's API endpoint: ```bash curl -s https://token.kuhung.me/api/prices ``` *(Note: If working in a local development environment, use `http://localhost:3000/api/prices` instead)* 2. **Analyze the Data**: - Find the requested models in the JSON response (`data` array). - Extract `input_price` (per 1M tokens) and `output_price` (per 1M tokens). - Note the `context_window` and any special features. 3. **Calculate Costs Based on Scenario**: If the user provides a scenario (e.g., "100k messages/day, 500 input tokens, 200 output tokens"): - Calculate daily input tokens: `messages * input_tokens` - Calculate daily output tokens: `messages * output_tokens` - Calculate monthly cost: `(daily_input / 1M * input_price + daily_output / 1M * output_price) * 30` 4. **Compare API vs Local Deployment (If requested)**: - Estimate the hardware cost for local deployment (e.g., 1x A100 80G is ~$1500/month on cloud, or ~$15,000 to buy). - Compare the monthly API cost with the monthly hardware cost. - Calculate the ROI/Breakeven point: `Hardware Cost / Monthly API Cost`. ## Example Usage **User**: "Compare the cost of using DeepSeek-V3 API vs GPT-4o for a customer service bot doing 10,000 messages a day (avg 1000 input, 500 output tokens)." **Agent Action**: 1. Fetch pricing for DeepSeek-V3 and GPT-4o. 2. Calculate Monthly Tokens: - Input: 10,000 * 1000 * 30 = 300M tokens/month - Output: 10,000 * 500 * 30 = 150M tokens/month 3. Calculate Cost: - DeepSeek-V3: (300 * $0.14) + (150 * $0.28) = $42 + $42 = $84/month - GPT-4o: (300 * $2.50) + (150 * $10.00) = $750 + $1500 = $2250/month 4. Present the comparison clearly to the user.
使用场景与示例 Prompt
安装完成后,你可以在 Cursor 的 Chat 或 Composer 中直接向 AI 提问:
- API 选型对比
"我要做一个每天处理 10 万条消息的客服机器人,调用 DeepSeek API 和 GPT-4o-mini 相比,哪个方案更省钱?" - 本地部署 ROI 计算
"帮我算一下,如果我每天有 500 万 token 的使用量,是租一台 A100 跑本地 Qwen2.5-7B 划算,还是直接调用通义千问的 API 划算?多久能回本?" - 模型价格查询
"查一下目前 Claude 3.5 Sonnet 的最新价格,并和国内同级别模型做个对比。"