Skip to content

免token使用openclaw Use openclaw without a token

Notifications You must be signed in to change notification settings

linuxhsj/openclaw-zero-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12,802 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenClaw Zero Token

Use AI Models Without API Tokens - Access DeepSeek, Doubao, Claude, ChatGPT and more for free via browser login authentication.

License: MIT

English | 简体中文


Overview

OpenClaw Zero Token is a fork of OpenClaw with a core mission: eliminate API token costs by capturing session credentials through browser automation, enabling free access to major AI platforms.

Why Zero Token?

Traditional Approach Zero Token Approach
Requires purchasing API tokens Completely free
Pay per API call No usage limits
Credit card binding required Only web login needed
Potential token leakage Credentials stored locally

Supported Platforms

Platform Status Models
DeepSeek Currently Supported deepseek-chat, deepseek-reasoner
Doubao (豆包) � Coming Soon -
Claude Web � Coming Soon -
ChatGPT Web � Coming Soon -

Note: Currently, only DeepSeek is fully supported. Support for Doubao, Claude, and ChatGPT is under active research and development.


System Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                              OpenClaw Zero Token                             │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐  │
│  │   Web UI    │    │  CLI/TUI    │    │   Gateway   │    │  Channels   │  │
│  │  (Lit 3.x)  │    │             │    │  (Port API) │    │ (Telegram…) │  │
│  └──────┬──────┘    └──────┬──────┘    └──────┬──────┘    └──────┬──────┘  │
│         │                  │                  │                  │          │
│         └──────────────────┴──────────────────┴──────────────────┘          │
│                                    │                                         │
│                           ┌────────▼────────┐                               │
│                           │   Agent Core    │                               │
│                           │  (PI-AI Engine) │                               │
│                           └────────┬────────┘                               │
│                                    │                                         │
│  ┌─────────────────────────────────┼─────────────────────────────────────┐  │
│  │                          Provider Layer                               │  │
│  │  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌───────────┐  │  │
│  │  │ DeepSeek API │  │ DeepSeek Web │  │   OpenAI     │  │ Anthropic │  │  │
│  │  │   (Token)    │  │  (Zero Token)│  │   (Token)    │  │  (Token)  │  │  │
│  │  └──────────────┘  └──────────────┘  └──────────────┘  └───────────┘  │  │
│  └───────────────────────────────────────────────────────────────────────┘  │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

How It Works

Zero Token Authentication Flow

┌────────────────────────────────────────────────────────────────────────────┐
│                     DeepSeek Web Authentication Flow                        │
├────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  1. Launch Browser                                                          │
│     ┌─────────────┐                                                        │
│     │ openclaw    │ ──start──▶ Chrome (CDP Port: 18892)                    │
│     │ gateway     │             with user data directory                   │
│     └─────────────┘                                                        │
│                                                                             │
│  2. User Login                                                              │
│     ┌─────────────┐                                                        │
│     │ User logs in│ ──visit──▶ https://chat.deepseek.com                   │
│     │  browser    │             scan QR / password login                    │
│     └─────────────┘                                                        │
│                                                                             │
│  3. Capture Credentials                                                     │
│     ┌─────────────┐                                                        │
│     │ Playwright  │ ──listen──▶ Network requests                           │
│     │ CDP Connect │              Intercept Authorization Header            │
│     └─────────────┘              Extract Cookies                            │
│                                                                             │
│  4. Store Credentials                                                       │
│     ┌─────────────┐                                                        │
│     │ auth.json   │ ◀──save── { cookie, bearer, userAgent }               │
│     └─────────────┘                                                        │
│                                                                             │
│  5. API Calls                                                               │
│     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐               │
│     │ DeepSeek    │ ──▶ │ DeepSeek    │ ──▶ │ chat.deep-  │               │
│     │ WebClient   │     │ Web API     │     │ seek.com    │               │
│     └─────────────┘     └─────────────┘     └─────────────┘               │
│         Using stored Cookie + Bearer Token                                  │
│                                                                             │
└────────────────────────────────────────────────────────────────────────────┘

Key Technical Components

Component Implementation
Browser Automation Playwright CDP connection to Chrome
Credential Capture Network request interception, Authorization Header extraction
PoW Challenge WASM SHA3 computation for anti-bot bypass
Streaming Response SSE parsing + custom tag parser

Quick Start

Requirements

  • Node.js >= 22.12.0
  • pnpm >= 9.0.0
  • Chrome Browser

Installation

# Clone the repository
git clone https://github.com/linuxhsj/openclaw-zero-token.git
cd openclaw-zero-token

# Install dependencies
pnpm install

# Build
pnpm build

Configure DeepSeek Web Authentication

# Run setup wizard
node openclaw.mjs onboard

# Select authentication method
? Auth provider: DeepSeek (Browser Login)

# Choose login mode
? DeepSeek Auth Mode: 
  > Automated Login (Recommended)  # Auto-capture credentials
    Manual Paste                   # Manually paste credentials

Start Gateway

# Start the service
node openclaw.mjs gateway

# Access Web UI
open http://127.0.0.1:3001

Usage

Web UI

Visit http://127.0.0.1:3001 and start chatting with DeepSeek models directly.

API Calls

# Call via Gateway Token
curl http://127.0.0.1:3001/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!"}]
  }'

CLI Mode

# Interactive terminal
node openclaw.mjs tui

Configuration

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": 3001,
    "auth": {
      "mode": "token",
      "token": "your-gateway-token"
    }
  }
}

Roadmap

Current Focus

  • ✅ DeepSeek Web authentication (stable)
  • 🔧 Improving credential capture reliability
  • 📝 Documentation improvements

Planned Features

  • 🔜 Doubao (豆包) Web authentication support
  • 🔜 Claude Web authentication support
  • 🔜 ChatGPT Web authentication support
  • 🔜 Auto-refresh for expired sessions

Adding New Platforms

To add support for a new platform, create the following files:

1. Authentication Module (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 }> {
  // Browser automation login, capture credentials
}

2. API Client (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. Stream Handler (src/agents/{platform}-web-stream.ts)

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

Project Structure

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 handler
│   ├── commands/
│   │   └── auth-choice.apply.deepseek-web.ts  # Authentication flow
│   └── browser/
│       └── chrome.ts                 # Chrome automation
├── ui/                               # Web UI (Lit 3.x)
├── .openclaw-state/                  # Local state (not committed)
│   ├── openclaw.json                 # Configuration
│   └── agents/main/agent/
│       └── auth.json                 # Credentials (sensitive)
└── .gitignore                        # Includes .openclaw-state/

Security Notes

  1. Credential Storage: Cookies and Bearer tokens are stored locally in auth.json, never committed to Git
  2. Session Expiry: Web sessions may expire and require periodic re-login
  3. Rate Limits: Web APIs may have rate limits, not suitable for high-frequency calls
  4. Compliance: For personal learning and research only, please comply with platform terms of service

Syncing with Upstream

This project is based on OpenClaw. Sync upstream updates with:

# Add upstream repository
git remote add upstream https://github.com/openclaw/openclaw.git

# Sync upstream updates
git fetch upstream
git merge upstream/main

Contributing

Contributions are welcome, especially:

  • New platform Web authentication support (Doubao, Claude, ChatGPT, etc.)
  • Bug fixes
  • Documentation improvements

License

MIT License


Acknowledgments


Disclaimer

This project is for learning and research purposes only. When using this project to access any third-party services, please ensure compliance with that service's terms of use. The developers are not responsible for any issues arising from the use of this project.

About

免token使用openclaw Use openclaw without a token

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 709