- 协议互译 — OpenAI Chat Completions · OpenAI Responses · Anthropic Messages,任意方向
- 流式透传 — SSE 逐事件转换,覆盖文本增量、工具调用与流式中断
- 多服务商 — 任意数量上游配置,一键热切换
- 模型同步 — 自动拉取上游模型列表,支持手动刷新
- 纯本地 — 全部流量走 localhost,无注册、无遥测
要求 macOS 14+、Xcode 16+、Swift 6+
从 GitHub Release 下载的包未做 Apple 公证。首次打开如果被系统拦截,可在终端执行:
xattr -dr com.apple.quarantine /Applications/TokenShare.app
git clone https://github.com/leemysw/token-share.git
cd token-share
swift build && swift run TokenShare或用 Xcode 打开 TokenShare.xcodeproj 直接运行。
启动后默认监听 localhost:9091:
| 路径 | 协议 |
|---|---|
/v1/chat/completions |
OpenAI Chat Completions |
/v1/responses |
OpenAI Responses |
/v1/messages |
Anthropic Messages |
/v1/models |
模型列表 |
/health |
健康检查 |
localhost:9091
│
┌─────────────┐ ┌──────────┴──────────┐ ┌──────────────┐
│ │───▶│ │───▶│ │
│ AI Client │ │ Token Share │ │ LLM Provider │
│ │◀───│ │◀───│ │
└─────────────┘ └─────────────────────┘ └──────────────┘
OpenAI 协议 协议识别 → 翻译 → 转发 Anthropic 协议
Anthropic 协议 SSE 逐事件流式转换 OpenAI 协议


