OpenClaw:无需 API Token 即可使用所有主流 AI 模型!

无需 API 令牌即可使用 LLM——只需通过浏览器登录一次,即可通过统一网关免费调用 ChatGPT、Claude、Gemini、DeepSeek、Qwen(国际/中国)、豆宝、Kimi、智普 GLM、Grok、Manus 等。


概述

OpenClaw Zero Token 是OpenClaw的一个分支,它专注于通过驱动官方 Web UI(浏览器登录)而不是付费 API 密钥来消除 API 令牌成本。

为什么选择零代币?

传统用法 零代币方式
购买 API 代币 完全免费
按需求付费 没有强制配额
需要信用卡 仅浏览器登录
API令牌可能泄露 本地存储的凭据

支持的提供商

提供者 地位 模型(示例)
深潜 :white_check_mark: 已测试 deepseek-chat,deepseek-reasoner
Qwen国际 :white_check_mark: 已测试 Qwen 3.5 Plus,Qwen 3.5 Turbo
Qwen China :white_check_mark: 已测试 Qwen 3.5 Plus,Qwen 3.5 Turbo
基米 :white_check_mark: 已测试 Moonshot v1 8K / 32K / 128K
克劳德·韦伯 :white_check_mark: 已测试 claude-sonnet-4-6, claude-opus-4-6, claude-haiku-4-6
豆宝 :white_check_mark: 已测试 豆宝-seed-2.0, 豆宝-pro
ChatGPT 网站 :white_check_mark: 已测试 GPT-4、GPT-4 Turbo
双子座网站 :white_check_mark: 已测试 Gemini Pro、Gemini Ultra
Grok Web :white_check_mark: 已测试 Grok 1,Grok 2
GLM Web(智浦) :white_check_mark: 已测试 glm-4-Plus,glm-4-Think
GLM Web(国际) :white_check_mark: 已测试 GLM-4 Plus,GLM-4 Think
马努斯API :white_check_mark: 已测试 Manus 1.6、Manus 1.6 Lite(API 密钥、免费配额)

工具调用

所有受支持的模型都可以调用本地工具exec,,,,,等) read_file,以便代理可以运行命令、读取/写入工作区文件和自动化浏览器。list_dirbrowserapply_patch

提供者类型 工具 笔记
Web(DeepSeek、Qwen、Kimi、Claude、豆宝、GLM、Grok 等) :white_check_mark: system在解析流中注入 XML 工具描述<tool_call>
ChatGPT Web / Gemini Web / Manus API :white_check_mark: 类似地,通过工具描述 + 多轮上下文 + <tool_call>
OpenRouter/OpenAI兼容的API :white_check_mark: 使用原生tools/ tool_calls
奥拉玛 :white_check_mark: 使用原生/api/chat工具。

代理文件访问受配置的工作区目录的限制(参见agents.defaults.workspace)。

额外功能

AskOnce:一个问题,所有模型的答案。AskOnce
可以将单个查询广播给多个已配置的提供者,并并排显示它们的回复。

AskOnce:一次提问,多种答案模式


工作原理

高级架构

┌─────────────────────────────────────────────────────────────────────────────┐
│                              OpenClaw Zero Token                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐  │
│  │   Web UI    │    │  CLI/TUI    │    │   Gateway   │    │  Channels   │  │
│  │  (Lit 3.x)  │    │             │    │  (Port API) │    │ (Telegram…) │  │
│  └──────┬──────┘    └──────┬──────┘    └──────┬──────┘    └──────┬──────┘  │
│         │                  │                  │                  │          │
│         └──────────────────┴──────────────────┴──────────────────┘          │
│                                    │                                         │
│                           ┌────────▼────────┐                               │
│                           │   Agent Core    │                               │
│                           │  (PI-AI Engine) │                               │
│                           └────────┬────────┘                               │
│                                    │                                         │
│  ┌───────────────────────────────────────────────────────────────────────┐  │
│  │  Provider Layer                                                       │  │
│  │  DeepSeek Web (Zero Token)                                       ✅   │  │
│  │  Qwen Web intl/cn (Zero Token)                                  ✅   │  │
│  │  Kimi (Zero Token)                                              ✅   │  │
│  │  Claude Web (Zero Token)                                        ✅   │  │
│  │  Doubao (Zero Token)                                            ✅   │  │
│  │  ChatGPT Web (Zero Token)                                       ✅   │  │
│  │  Gemini Web (Zero Token)                                        ✅   │  │
│  │  Grok Web (Zero Token)                                          ✅   │  │
│  │  GLM Web (Zero Token)                                           ✅   │  │
│  │  Manus API (Token)                                              ✅   │  │
│  └───────────────────────────────────────────────────────────────────────┘  │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

DeepSeek 身份验证流程(示例)

1. Start browser
   openclaw gateway  ──▶  Chrome (CDP: 18892, user-data-dir)

2. User logs in
   Browser  ──▶  https://chat.deepseek.com  (scan / password login)

3. Capture credentials
   Playwright CDP  ──▶  listen network requests
                    └─▶ intercept Authorization header + cookies

4. Store credentials
   auth.json  ◀──  { cookie, bearer, userAgent }

5. Call web API
   DeepSeek WebClient  ──▶  DeepSeek Web API  ──▶  chat.deepseek.com
   (reuses stored cookie + bearer token)


快速入门

平台

  • :red_apple: macOS / :penguin: Linux:请按照START_HERE.md进行操作;完整的安装/配置信息请参见INSTALLATION.md。

  • :window: Windows:请使用 WSL2,然后按照 Linux 步骤操作。安装 WSL2:,wsl --install文档:https ://docs.microsoft.com/windows/wsl/install

要求

  • Node.js 版本 >= 22.12.0

  • pnpm >= 9.0.0

  • Chrome浏览器

  • 操作系统:macOS、Linux 或 Windows(通过 WSL2)

辅助脚本(首次使用和日常使用)

First-time:
  1. Build          pnpm install && pnpm build && pnpm ui:build
  2. Start Chrome   ./start-chrome-debug.sh
  3. Login sites    Qwen intl/cn, Kimi, DeepSeek, ...
  4. Onboard        ./onboard.sh webauth
  5. Start server   ./server.sh

Daily:
  start-chrome-debug.sh → onboard.sh → server.sh
  server.sh [start|stop|restart|status] manages the gateway

脚本概览(核心 3 个脚本):

脚本 目的 何时使用
start-chrome-debug.sh 以调试模式启动 Chrome 步骤 2:打开浏览器,访问端口 9222 进行登录和注册
onboard.sh 身份验证/注册向导 步骤 4/5:选择提供商(例如deepseek-web)并获取凭据
server.sh 管理网关服务 步骤 5 及日常使用:start/ stop/ restart/status在端口 3002

安装

克隆仓库

git clone https://github.com/linuxhsj/openclaw-zero-token.git
cd openclaw-zero-token

安装依赖项

pnpm install

步骤 1:构建

pnpm build
pnpm ui:build

步骤 2:配置身份验证

# (Optional but recommended before the very first ./onboard.sh webauth)
# Copy the example config to your local state directory:
# cp .openclaw-state.example/openclaw.json .openclaw-upstream-state/openclaw.json

# On first run, onboard.sh will prompt whether to copy the configuration file, just select yes.
# It will copy .openclaw-state.example/openclaw.json to .openclaw-upstream-state/openclaw.json;
# for non-first runs, there's no need to copy these configuration files.

# Start Chrome in debug mode
./start-chrome-debug.sh

# IMPORTANT: Do not close this terminal, otherwise subsequent steps will fail.
# Keep this terminal open throughout the process.

# Log into each web model once (for example DeepSeek)
#   https://chat.deepseek.com/

# Run onboarding wizard
# IMPORTANT: Open a new terminal for this step (do not use the same terminal as the previous step,
# because the ./start-chrome-debug.sh terminal needs to stay open).
./onboard.sh webauth


# Or use the built version
node openclaw.mjs onboard

# Example DeepSeek flow in the wizard:
# ? Auth provider: DeepSeek (Browser Login)
#
# ? DeepSeek Auth Mode:
#   > Automated Login (Recommended)   # capture cookies/tokens automatically

# Once you see that auth succeeded, you are done.
# To add more providers later, just run ./onboard.sh webauth again.

按照提示操作(例如,选择DeepSeek(浏览器登录)自动登录(推荐))。
以后如需添加更多提供商,只需./onboard.sh webauth再次运行即可。

步骤 3:启动网关

./server.sh

这将启动HTTP网关和Web用户界面。


用法

Web 用户界面

./server.shWeb 用户界面会自动启动。在浏览器中打开它,即可与任何已配置的模特聊天。

切换模型

/model在聊天框内使用:

# Switch to Claude Web
/model claude-web

# Switch to Doubao
/model doubao-web

# Switch to DeepSeek
/model deepseek-web

# Or specify exact models
/model claude-web/claude-sonnet-4-6
/model doubao-web/doubao-seed-2.0
/model deepseek-web/deepseek-chat

列出可用型号

/models

**重要提示:**只有通过配置的提供商./onboard.sh webauth才会写入openclaw.json并显示在/models.

输出结果显示:

  • 所有可用提供商(例如claude-web,,doubao-webdeepseek-web

  • 各供应商旗下的模型

  • 当前活跃型号

  • 别名和配置

例子:

Model                                      Input      Ctx      Local Auth  Tags
doubao-web/doubao-seed-2.0                 text       63k      no    no    default,configured,alias:Doubao Browser
claude-web/claude-sonnet-4-6         text+image 195k     no    no    configured,alias:Claude Web
deepseek-web/deepseek-chat                 text       64k      no    no    configured

HTTP API

curl http://127.0.0.1:3002/v1/chat/completions \
  -H "Authorization: Bearer YOUR_GATEWAY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-web/deepseek-chat",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

命令行界面/终端用户界面

node openclaw.mjs tui

配置

例子openclaw.json

{
  "auth": {
    "profiles": {
      "deepseek-web:default": {
        "provider": "deepseek-web",
        "mode": "api_key"
      }
    }
  },
  "models": {
    "providers": {
      "deepseek-web": {
        "baseUrl": "https://chat.deepseek.com",
        "api": "deepseek-web",
        "models": [
          {
            "id": "deepseek-chat",
            "name": "DeepSeek Chat",
            "contextWindow": 64000,
            "maxTokens": 4096
          },
          {
            "id": "deepseek-reasoner",
            "name": "DeepSeek Reasoner",
            "reasoning": true,
            "contextWindow": 64000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "gateway": {
    "port": 3002,
    "auth": {
      "mode": "token",
      "token": "your-gateway-token"
    }
  }
}

故障排除

首次运行:使用引导向导(推荐)

./onboard.sh webauth

向导将创建所有必需的目录和基本文件。

修复问题:医生命令

如果您已经运行了项目,但看到缺少目录或类似错误:

node dist/index.mjs doctor

医生指令将:

  • :white_check_mark: 检查所有必需目录

  • :white_check_mark: 创建缺失的目录

  • :white_check_mark: 修复常见权限问题

  • :white_check_mark: 验证配置文件结构

  • :white_check_mark: 检测多个冲突的状态目录

  • :white_check_mark: 打印详细建议

局限性:

  • :cross_mark:创建openclaw.json

  • :cross_mark:创建auth-profiles.json

  • :white_check_mark: 如果这些文件缺失/损坏,请重新运行./onboard.sh webauth


路线图

当前重点

  • :white_check_mark: DeepSeek Web、Qwen intl/cn、Kimi、Claude Web、豆宝、ChatGPT Web、Gemini Web、Grok Web、GLM Web、GLM intl、Manus API — 全部经过测试

  • :wrench: 提高凭证捕获的稳健性

  • :memo: 文档改进

计划

  • :soon_arrow: 自动刷新已过期的网络会话

新增平台

要添加新的网络服务提供商,通常需要:

1. 身份验证模块(src/providers/{platform}-web-auth.ts

export async function loginPlatformWeb(params: {
  onProgress: (msg: string) => void;
  openUrl: (url: string) => Promise<boolean>;
}): Promise<{ cookie: string; bearer: string; userAgent: string }> {
  // Automate browser login and capture credentials
}

2. API 客户端(src/providers/{platform}-web-client.ts

export class PlatformWebClient {
  constructor(options: { cookie: string; bearer?: string }) {}

  async chatCompletions(params: ChatParams): Promise<ReadableStream> {
    // Call platform web API
  }
}

3. 流处理程序( src/agents/{platform}-web-stream.ts)

export function createPlatformWebStreamFn(credentials: string): StreamFn {
  // Handle provider-specific streaming format
}

文件结构

openclaw-zero-token/
├── src/
│   ├── providers/
│   │   ├── deepseek-web-auth.ts          # DeepSeek login capture
│   │   └── deepseek-web-client.ts        # DeepSeek API client
│   ├── agents/
│   │   └── deepseek-web-stream.ts        # Streaming response handling
│   ├── commands/
│   │   └── auth-choice.apply.deepseek-web.ts  # Auth flow
│   └── browser/
│       └── chrome.ts                     # Chrome automation
├── ui/                                   # Web UI (Lit 3.x)
├── .openclaw-zero-state/                 # Local state (ignored)
│   ├── openclaw.json                     # Config
│   └── agents/main/agent/
│       └── auth.json                     # Credentials (sensitive)
└── .gitignore                            # Includes .openclaw-zero-state/


安全说明

  1. 凭证存储:cookie 和 bearer token 存储在本地auth.json绝不能提交。

  2. 会话生命周期:网络会话有过期时间;您可能需要不时重新登录。

  3. 速率限制:Web 端点可能会强制执行速率限制;它们不适合繁重的生产工作负载。

  4. 合规声明:本项目仅供个人学习和实验之用。请务必遵守各平台的服务条款。


与上游 OpenClaw 同步

本项目基于 OpenClaw。要同步上游更改:

git remote add upstream https://github.com/openclaw/openclaw.git
git fetch upstream
git merge upstream/main

贡献

欢迎提交 PR,特别是以下类型的 PR:

  • 错误修复

  • 文档改进

学到了,之前一直不知道这个