Tools
Zero Token
openclaw-zero-token-plugin
Install
npm install
npm
Configuration Example
{
"zeroToken": {
"enabled": true,
"server": {
"port": 3001,
"host": "localhost"
},
"browser": {
"headless": true,
"timeout": 30000,
"maxInstances": 3
},
"cache": {
"enabled": true,
"ttl": 3600,
"maxSize": 100
}
}
}
README
# OpenClaw Zero Token Plugin
一个为OpenClaw提供免token调用主流AI模型的插件。通过浏览器自动化技术,绕过API付费机制,实现零成本访问DeepSeek、Claude、Kimi、智谱清言等平台。
## ✨ 特性
- **完全免费**:无需API token,零成本使用
- **多平台支持**:DeepSeek Web、Claude Web、Kimi、智谱清言等
- **无缝集成**:遵循OpenClaw插件标准,配置即用
- **安全可靠**:本地加密存储凭证,不传输敏感信息
- **高性能**:内置缓存、队列管理和连接池
## 🚀 快速开始
### 安装
```bash
# 从npm安装
openclaw plugins install @openclaw/zero-token-plugin
# 或从源码安装
git clone https://github.com/WenKaiYang/openclaw-zero-token-plugin.git
cd openclaw-zero-token-plugin
npm install
npm run build
openclaw plugins install ./dist
```
### 配置
```bash
# 启用插件
openclaw config set plugins.zero-token-provider.enabled true
# 配置基础设置
openclaw config set zeroToken.enabled true
openclaw config set zeroToken.server.port 3001
# 启用平台
openclaw config set zeroToken.platforms.deepseek.enabled true
openclaw config set zeroToken.platforms.claude.enabled true
# 配置模型路由
openclaw config set models.providers.zero-token.baseUrl "http://localhost:3001/v1"
openclaw config set models.defaults.model.primary "zero-token/auto"
```
### 验证
```bash
# 检查服务状态
curl http://localhost:3001/health
# 查看支持模型
curl http://localhost:3001/v1/models
# 测试请求
curl -X POST http://localhost:3001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "zero-token/deepseek-web",
"messages": [{"role": "user", "content": "Hello"}]
}'
```
## 📋 支持平台
| 平台 | 状态 | 支持模型 | 备注 |
|------|------|----------|------|
| DeepSeek Web | ✅ | DeepSeek最新模型 | 完全免费 |
| Claude Web | ✅ | Claude Sonnet/Opus/Haiku | 需要登录 |
| Kimi | ✅ | Moonshot系列 | 长上下文支持 |
| 智谱清言 | ✅ | GLM-4系列 | 国内稳定 |
| 豆包 | ⏳ | Doubao系列 | 开发中 |
| 通义千问 | ⏳ | Qwen系列 | 开发中 |
| Gemini Web | ⏳ | Gemini Pro/Ultra | 开发中 |
## ⚙️ 配置说明
### 基础配置
```json
{
"zeroToken": {
"enabled": true,
"server": {
"port": 3001,
"host": "localhost"
},
"browser": {
"headless": true,
"timeout": 30000,
"maxInstances": 3
},
"cache": {
"enabled": true,
"ttl": 3600,
"maxSize": 100
}
}
}
```
### 平台配置
```json
{
"zeroToken": {
"platforms": {
"deepseek": {
"enabled": true,
"credentials": {
"username": "[email protected]",
"password": "optional-password"
}
},
"claude": {
"enabled": true
}
}
}
}
```
## 🛠️ 开发指南
### 环境设置
```bash
# 克隆项目
git clone https://github.com/WenKaiYang/openclaw-zero-token-plugin.git
cd openclaw-zero-token-plugin
# 安装依赖
npm install
# 安装Playwright浏览器
npx playwright install
# 启动开发服务器
npm run dev
```
### 添加新平台
1. 创建平台适配器 `src/zero-token-service/platforms/new-platform.js`
2. 实现 `PlatformAdapter` 基类方法
3. 注册到平台管理器 `src/zero-token-service/platforms/index.js`
4. 添加配置schema `config/schema.json`
5. 编写测试用例
### 项目结构
```
openclaw-zero-token-plugin/
├── src/
│ ├── index.js # 插件主入口
│ ├── zero-token-service/ # 核心服务
│ ├── openclaw-adapter/ # OpenClaw适配层
│ └── cli/ # 命令行工具
├── config/ # 配置文件
├── docs/ # 文档
├── examples/ # 使用示例
└── tests/ # 测试代码
```
## 🔧 故障排查
### 常见问题
1. **服务启动失败**
- 检查端口是否被占用:`lsof -i:3001`
- 确保Playwright浏览器已安装:`npx playwright install`
2. **登录失败**
- 检查网络连接
- 验证平台账号密码
- 查看日志:`tail -f ~/.openclaw/logs/zero-token.log`
3. **请求超时**
- 调整浏览器超时时间
- 检查平台访问限制
- 启用缓存减少重复请求
### 获取帮助
- [提交Issue](https://github.com/WenKaiYang/openclaw-zero-token-plugin/issues)
- 查看详细文档
- 联系维护者
## 📄 许可证
MIT License
## 🙏 致谢
- [OpenClaw](https://github.com/openclaw/openclaw) - 优秀的AI智能体框架
- [Playwright](https://playwright.dev) - 强大的浏览器自动化工具
- 所有贡献者和用户
---
**注意**:本项目通过浏览器自动化技术实现免token访问,请遵守各平台的使用条款。仅限个人学习和研究使用。
tools
Comments
Sign in to leave a comment