feat: add auto token refresh for ALL platforms
New qwen-token-refresh.sh script provides automatic token refresh for OpenClaw, NanoBot, PicoClaw, NanoClaw (ZeroClaw has native support). Features: - Check token status and expiry - Auto-refresh when < 5 min remaining - Background daemon mode (5 min intervals) - Systemd service installation - Updates both oauth_creds.json and .env file Usage: ./scripts/qwen-token-refresh.sh --status # Check status ./scripts/qwen-token-refresh.sh # Refresh if needed ./scripts/qwen-token-refresh.sh --daemon # Background daemon ./scripts/qwen-token-refresh.sh --install # Systemd service Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ End-to-end professional setup of AI Agent platforms with **25+ OpenCode-compatib
|
||||
│ • Works with: OpenClaw, NanoBot, PicoClaw, ZeroClaw │
|
||||
│ • Model: coder-model (qwen3-coder-plus) │
|
||||
│ • Auth: Browser OAuth via qwen.ai │
|
||||
│ • Token refresh: Automatic (ZeroClaw) / Manual (others) │
|
||||
│ • Token refresh: Automatic (ALL platforms) │
|
||||
│ • DEFAULT: Recommended as primary provider │
|
||||
│ │
|
||||
│ FEATURE 2: 25+ OpenCode-Compatible AI Providers │
|
||||
@@ -145,6 +145,46 @@ picoclaw # PicoClaw with FREE Qwen
|
||||
nanoclaw # NanoClaw with FREE Qwen
|
||||
```
|
||||
|
||||
## Auto Token Refresh (ALL Platforms)
|
||||
|
||||
Use the included refresh script to automatically refresh expired tokens:
|
||||
|
||||
```bash
|
||||
# Check token status
|
||||
./scripts/qwen-token-refresh.sh --status
|
||||
|
||||
# Refresh if expired
|
||||
./scripts/qwen-token-refresh.sh
|
||||
|
||||
# Run as background daemon (checks every 5 min)
|
||||
./scripts/qwen-token-refresh.sh --daemon
|
||||
|
||||
# Install as systemd service (auto-start on boot)
|
||||
./scripts/qwen-token-refresh.sh --install
|
||||
systemctl --user enable --now qwen-token-refresh
|
||||
```
|
||||
|
||||
### How Auto-Refresh Works
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────────────┐
|
||||
│ AUTO TOKEN REFRESH FLOW │
|
||||
├─────────────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 1. Check expiry_date in ~/.qwen/oauth_creds.json │
|
||||
│ 2. If expired (< 5 min buffer): │
|
||||
│ POST https://chat.qwen.ai/api/v1/oauth2/token │
|
||||
│ Body: grant_type=refresh_token&refresh_token=xxx │
|
||||
│ 3. Response: { access_token, refresh_token, expires_in } │
|
||||
│ 4. Update ~/.qwen/oauth_creds.json with new tokens │
|
||||
│ 5. Update ~/.qwen/.env with new OPENAI_API_KEY │
|
||||
│ 6. Platforms using source ~/.qwen/.env get fresh token │
|
||||
│ │
|
||||
│ Systemd service: Runs every 5 minutes, refreshes when needed │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# FEATURE 2: 25+ OpenCode-Compatible AI Providers
|
||||
|
||||
Reference in New Issue
Block a user