ohmytoken
Provides real-time token pricing for AI models, model comparison, cost calculation, and token usage tracking for agents and developers.
README
<p align="center"> <span style="font-size:64px">🪙</span> </p>
<h1 align="center">OhMyToken</h1>
<p align="center"> <strong>AI Token Price Intelligence for Agents & Developers</strong> </p>
<p align="center"> <a href="https://www.ohmytoken.com">Website</a> · <a href="https://www.ohmytoken.com/agents.txt">agents.txt</a> · <a href="#mcp-server">MCP Server</a> · <a href="#rest-api">REST API</a> · <a href="#token-tracker">Token Tracker</a> </p>
<p align="center"> <img src="https://img.shields.io/badge/models-23+-6366F1" alt="Models" /> <img src="https://img.shields.io/badge/providers-8-3B82F6" alt="Providers" /> <img src="https://img.shields.io/badge/MCP_tools-10-10B981" alt="MCP Tools" /> <img src="https://img.shields.io/badge/i18n-zh%20%7C%20en-F59E0B" alt="i18n" /> <img src="https://img.shields.io/badge/license-MIT-gray" alt="License" /> </p>
Real-time token pricing for 23 AI models across 8 providers (Anthropic, OpenAI, Google, DeepSeek, Zhipu, MiniMax, Moonshot, Alibaba). Built for agents — not just humans.
Features
Price Intelligence
- Real-time pricing table with sorting, filtering by provider/category/open-source
- Token cost calculator — input your usage, see daily/monthly costs across all models
- Price evolution timeline — from GPT-4 ($30/MTok) to DeepSeek V3 ($0.3/MTok)
Agent-First Design
- MCP Server — 5 tools for price queries, model comparison, smart recommendations
- Token Tracker — 5 tools for consumption logging, budget management, efficiency analysis
- REST API — 12 endpoints for programmatic access
- agents.txt — Machine-readable service description at
/agents.txt
Bilingual — Chinese / English with automatic RMB / USD currency conversion
Quick Start
git clone https://github.com/LangGPT/ohmytoken.git
cd ohmytoken
npm install
npm run build
npm run dev # → http://localhost:18090
MCP Server
Add to your Claude Code settings.json:
{
"mcpServers": {
"ohmytoken": {
"command": "npx",
"args": ["tsx", "src/mcp/index.ts"]
}
}
}
Tools:
| Tool | Description |
|---|---|
get_token_price |
Get real-time pricing for any model or provider |
compare_models |
Side-by-side comparison of 2+ models |
recommend_model |
Smart recommendation by task, budget, preferences |
calculate_cost |
Estimate costs for a workload across all models |
get_price_trends |
Historical token price trends since 2023 |
Token Tracker
Every agent deserves a financial dashboard. Track your token spending like wandb tracks experiments.
{
"mcpServers": {
"ohmytoken-tracker": {
"command": "npx",
"args": ["tsx", "src/mcp/tracker.ts"]
}
}
}
Tools:
| Tool | Description |
|---|---|
token_log |
Record token consumption (cost auto-calculated) |
token_usage |
Query spending by period, model, or task |
token_budget |
Set daily/monthly limits with auto-warnings |
token_analyze |
Spending patterns and optimization suggestions |
token_leaderboard |
Multi-agent ranking — who's most efficient? |
Data stored in ~/.ohmytoken/ledger.jsonl (append-only, portable).
REST API
Base URL: https://www.ohmytoken.com/api (or http://localhost:18090/api)
# All models
curl /api/models?provider=anthropic
# Cost calculation
curl -X POST /api/calculate \
-d '{"inputTokens":1000000,"outputTokens":500000,"requestsPerDay":100}'
# Smart recommendation
curl -X POST /api/recommend \
-d '{"task":"coding","preferOpenSource":true}'
# Log agent token usage
curl -X POST /api/tracker/log \
-d '{"agent_id":"my-agent","model":"claude-opus-4-6","input_tokens":5000,"output_tokens":1000}'
# Agent leaderboard
curl /api/tracker/leaderboard
Models Covered
| Provider | Models | Price Range (Input $/MTok) |
|---|---|---|
| Anthropic | Opus 4.6, Sonnet 4.5, Haiku 4.5 | $1 — $5 |
| OpenAI | GPT-5.2, GPT-4.1, o3, o4-mini | $0.1 — $2 |
| Gemini 2.5 Pro, 2.5 Flash, 2.0 Flash | $0.1 — $1.25 | |
| DeepSeek | V3, R1 | $0.3 — $0.7 |
| Zhipu | GLM-5, GLM-5 Code, GLM-4.7 | $0.07 — $1.2 |
| MiniMax | M2.1 | $0.3 |
| Moonshot | Kimi K2, Kimi K2.5 | $0.6 |
| Alibaba | Qwen3-Max, QwQ-Plus | $0.8 — $1.2 |
Project Structure
ohmytoken/
├── src/
│ ├── client/ # React SPA (bilingual, light theme)
│ │ ├── components/ # PriceTable, Calculator, Timeline, AgentDashboard, ...
│ │ ├── i18n.ts # zh/en translations, RMB/USD conversion
│ │ └── styles.css # Light theme with glass morphism
│ ├── server/ # Express API server (port 18090)
│ ├── mcp/
│ │ ├── index.ts # Price intelligence MCP server
│ │ └── tracker.ts # Token consumption tracker MCP server
│ └── shared/ # Types, data, tracker storage
├── docs/ # GitHub Pages static build
├── public/ # Static assets (index.html, agents.txt)
└── build.js # esbuild bundler
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。