Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenBalance

Monitor your LLM API balances from the macOS menu bar
在菜单栏查看所有 LLM API 余额 · 一键管理 31 个厂商

macOS Python MIT PRs Stars Downloads

ProvidersQuick StartCommandsUninstallBuild



"Install once, check all balances in one click."
「一次安装,全部余额一目了然」


🌟 Overview / 概述

OpenBalance is a lightweight macOS menu bar app that tracks API balances across all your LLM providers. No more logging into 10 dashboards.

  • 🔑 Secure — Keys in macOS Keychain, never on disk
  • 🌏 31 providers — DeepSeek, Kimi, Qwen, OpenRouter, Groq...
  • Auto-refresh — Default every 5 minutes, adjustable
  • 🧹 Clean uninstall — Built-in uninstaller wipes all traces

OpenBalance 是一款轻量级 macOS 菜单栏应用,让你在一个地方查看所有 LLM API 余额。再也不用登录 10 个后台去查余额。

  • 🔑 安全 — API key 存于 macOS 钥匙串,不会保存到本地文件
  • 🌏 31 个厂商 — DeepSeek、Kimi、Qwen、OpenRouter、Groq...
  • 自动刷新 — 默认每 5 分钟刷新,可调整
  • 🧹 彻底卸载 — 内建卸载器,清除所有数据 + 钥匙串条目

🗺 Supported Providers / 支持厂商

31 providers pre-configured with China (大陆) & International (海外) endpoints

31 个厂商已预设,大陆/海外 endpoint 都已配置

#ProviderEndPoint¥/$Status
1DeepSeek/user/balance¥
2Kimi (月之暗面 大陆)moonshot.cn/v1/users/me/balance¥
3Kimi (Moonshot 海外)moonshot.ai/v1/users/me/balance$
4智谱 GLMopen.bigmodel.cn/api/llm/balance¥
5SiliconFlow 大陆siliconflow.cn/v1/user/info¥
6SiliconFlow 海外siliconflow.com/v1/user/info$
7通义千问 (Qwen 大陆)dashscope.aliyuncs.com/.../balance¥
8通义千问 (Qwen 海外)dashscope-intl.aliyuncs.com/.../balance$
9百度文心 (ERNIE)aip.baidubce.com/rpc/2.0/billing/balance¥
10MiniMax (海螺AI)api.minimax.chat/v1/wallet/balance¥⚠️
11百川 (Baichuan)api.baichuan-ai.com/v1/user/balance¥⚠️
12阶跃星辰 (StepFun)api.stepfun.com/v1/user/balance¥⚠️
13零一万物 (Yi)api.lingyiwanwu.com/v1/user/balance¥⚠️
14腾讯混元api.hunyuan.cloud.tencent.com/...¥⚠️
15讯飞星火spark-api.xf-yun.com/v1/private/balance¥⚠️
16豆包 (火山引擎)open.volcengineapi.com/.../list_bill¥⚠️
17OpenRouteropenrouter.ai/api/v1/auth/key$
18Groqapi.groq.com/.../dashboard/billing/usage$
19Together AIapi.together.xyz/v1/user/credits$
20OpenAIapi.openai.com/.../billing/credit_grants$
21Anthropic (Claude)api.anthropic.com/v1/organizations$
22Google Geminino balance API$
23xAI (Grok)no balance API$
24Mistral AIapi.mistral.ai/v1/users/me$⚠️
25Perplexityno balance API$
26Cohereapi.cohere.ai/v1/account/balance$
27Replicateapi.replicate.com/v1/account$
28HuggingFacehuggingface.co/api/whoami$
29Fireworks AIapi.fireworks.ai/v1/user/balance$⚠️

✅ = confirmed endpoint exists · ⚠️ = endpoint guessed, may need ep <n> <url> to set · — = no balance API available

✅ = endpoint 已验证 · ⚠️ = endpoint 为推测,可能需要 ep <编号> <链接> 手动设置 · — = 该厂商无余额 API


⚡ Quick Start / 快速开始

Install / 安装

1. Download OpenBalance.dmg
2. Open it → drag to Applications
3. Right-click → Open (first time)

👇 Then click 💰 ⚙ in the menu bar

Set API Key / 设置密钥

security add-generic-password \
  -a 'openbalance-deepseek' \
  -s 'com.openbalance.deepseek' \
  -w 'sk-your-key-here' \
  -U

👇 Then type 1 in Configure to toggle DeepSeek on


⌨️ Commands / 命令参考

Open the menu bar → ⚙ 配置 → type one of:

打开菜单栏 → ⚙ 配置 → 输入以下命令:

Command / 命令 Example / 示例 Description / 说明
<number> 3 Toggle provider on/off · 开关 provider
key <n> <secret> key 1 sk-xxx Store API key · 存入钥匙串
remove <n> remove 1 Delete API key · 删除钥匙串
ep <n> <url> ep 3 https://... Override endpoint · 修改 API 地址
refresh <sec> refresh 600 Change interval · 改刷新间隔
all on / off all on Enable/disable all · 全部开/关

Quick example / 快速示例:

1               → enable DeepSeek · 开启 DeepSeek
key 1 sk-xxx    → store key · 存入密钥
17              → also enable OpenRouter · 再开启 OpenRouter
refresh 600     → check every 10min · 每 10 分钟刷新

🧹 Uninstall / 卸载

✅ Method 1: Built-in / 内建卸载 (推荐)

1. Click 「💰 ⚙」→ 「🗑 卸载」
2. Confirm → all keys + config wiped
3. Drag OpenBalance.app to Trash

🔧 Method 2: Manual / 手动清理

pkill -f "main_script"                # kill process
rm -rf /Applications/OpenBalance.app   # remove app
rm -rf ~/.llm-balance                  # remove config

# Remove all Keychain entries / 删除所有钥匙串条目
for pid in deepseek moonshot-cn moonshot-intl zhipu \
  siliconflow-cn siliconflow-us qwen-cn qwen-intl baidu \
  minimax baichuan stepfun lingyi tencent spark doubao \
  openrouter groq together openai anthropic google xai \
  mistral perplexity cohere replicate hf fireworks; do
  security delete-generic-password \
    -a "openbalance-$pid" -s "com.openbalance.$pid" 2>/dev/null
done

🔧 Architecture / 架构

App Structure / 应用结构

OpenBalance.app/
├── Contents/
│   ├── Info.plist
│   ├── MacOS/
│   │   └── OpenBalance    ← C launcher (33KB)
│   └── Resources/
│       ├── main_script.py ← Python app
│       └── applet.icns    ← Icon

Data Storage / 数据存储

Data / 数据 Location / 位置
Config / 配置 ~/.llm-balance/config.json
Custom endpoints / 自定义 endpoint ~/.llm-balance/endpoints.json
API Keys macOS Keychain com.openbalance.*
Debug log / 日志 ~/.llm-balance/app.log

🔨 Build from Source / 从源码构建

# Requirements / 前置条件
pip3 install rumps pyobjc Pillow

# Clone / 克隆
git clone https://github.com/Monah-Limited/OpenBalance.git
cd OpenBalance

# Build launcher / 编译启动器
clang -O2 -o OpenBalance.app/Contents/MacOS/OpenBalance scripts/launcher.c

# Sign ad-hoc / 签名
codesign --force --deep --sign - OpenBalance.app

# Package DMG / 打包
mkdir -p /tmp/dmg-src
cp -R OpenBalance.app /tmp/dmg-src/
ln -s /Applications /tmp/dmg-src/Applications
hdiutil create -volname "OpenBalance" -srcfolder /tmp/dmg-src \
  -ov -format UDZO -fs HFS+ OpenBalance.dmg

📄 License / 许可证

MIT

MIT — Free to use, modify, and distribute.
MIT 许可证 — 自由使用、修改、分发。


🙏 Credits / 致谢

Project Role
rumps macOS menu bar framework
PyObjC Python-macOS bridge
Pillow Icon generation and image processing
macOS Keychain Secure API key storage
All 31+ provider API teams Balance endpoint documentation and maintenance
项目 作用
rumps macOS 菜单栏框架
PyObjC Python-macOS 桥接
Pillow 图标生成与图片处理
macOS Keychain API 密钥安全存储
All 31+ provider API teams 余额接口文档与维护


Made with ❤️ by Monah Limited

🐛 Report Bug / 报告问题 · ✨ Feature Request / 功能建议 · 📋 Roadmap / 路线图

About

macOS menu-bar LLM API balance monitor for DeepSeek, OpenAI, Claude, Gemini, 30+ providers.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages