feat: use correct DashScope API endpoint for Qwen OAuth
Based on ZeroClaw implementation study: - Change API endpoint from api.qwen.ai to dashscope.aliyuncs.com/compatible-mode/v1 - Update credentials file reference to oauth_creds.json - Add ZeroClaw native qwen-oauth provider documentation - Add API endpoints and models reference table - Update import script with correct endpoint and platform support - Add PicoClaw and NanoClaw platform configurations Key findings from ZeroClaw binary: - Native qwen-oauth provider with auto token refresh - Uses DashScope OpenAI-compatible endpoint - Reads ~/.qwen/oauth_creds.json directly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
---
|
||||
name: claw-setup
|
||||
description: Use this skill when the user asks to "setup openclaw", "install nanobot", "deploy zeroclaw", "configure picoclaw", "setup qwen code", "import qwen oauth", "use free qwen tier", "configure AI providers", "add openai provider", "AI agent setup", or mentions setting up AI platforms.
|
||||
version: 1.3.0
|
||||
version: 2.0.0
|
||||
---
|
||||
|
||||
# Claw Setup Skill
|
||||
|
||||
End-to-end professional setup of AI Agent platforms with **25+ OpenCode-compatible providers** and **FREE Qwen OAuth cross-platform import**.
|
||||
|
||||
## ⭐ Two Key Features
|
||||
## Two Key Features
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
@@ -21,6 +21,7 @@ End-to-end professional setup of AI Agent platforms with **25+ OpenCode-compatib
|
||||
│ • Works with: OpenClaw, NanoBot, PicoClaw, ZeroClaw │
|
||||
│ • Model: Qwen3-Coder (optimized for coding) │
|
||||
│ • Auth: Browser OAuth via qwen.ai │
|
||||
│ • Token refresh: Automatic (ZeroClaw) / Manual (others) │
|
||||
│ │
|
||||
│ FEATURE 2: 25+ OpenCode-Compatible AI Providers │
|
||||
│ ───────────────────────────────────────────────── │
|
||||
@@ -38,10 +39,10 @@ End-to-end professional setup of AI Agent platforms with **25+ OpenCode-compatib
|
||||
| Platform | Language | Memory | Qwen OAuth | All Providers | Best For |
|
||||
|----------|----------|--------|------------|---------------|----------|
|
||||
| **Qwen Code** | TypeScript | ~200MB | ✅ Native | ✅ | FREE coding |
|
||||
| **ZeroClaw** | Rust | <5MB | ✅ Native | ✅ | Max performance |
|
||||
| **PicoClaw** | Go | <10MB | ✅ Import | ✅ | Embedded |
|
||||
| **OpenClaw** | TypeScript | >1GB | ✅ Import | ✅ | Full-featured |
|
||||
| **NanoBot** | Python | ~100MB | ✅ Import | ✅ | Research |
|
||||
| **PicoClaw** | Go | <10MB | ✅ Import | ✅ | Embedded |
|
||||
| **ZeroClaw** | Rust | <5MB | ✅ Import | ✅ | Performance |
|
||||
| **NanoClaw** | TypeScript | ~50MB | ✅ Import | ✅ | WhatsApp |
|
||||
|
||||
---
|
||||
@@ -51,32 +52,80 @@ End-to-end professional setup of AI Agent platforms with **25+ OpenCode-compatib
|
||||
## Get FREE Qwen OAuth
|
||||
|
||||
```bash
|
||||
# Install Qwen Code
|
||||
# Install Qwen Code CLI
|
||||
npm install -g @qwen-code/qwen-code@latest
|
||||
|
||||
# Authenticate (FREE)
|
||||
qwen
|
||||
/auth # Select "Qwen OAuth" → Browser login with qwen.ai
|
||||
# Authenticate (FREE - opens browser)
|
||||
qwen --auth-type qwen-oauth -p "test"
|
||||
|
||||
# FREE: 2,000 requests/day, 60 req/min
|
||||
# Credentials saved to: ~/.qwen/oauth_creds.json
|
||||
```
|
||||
|
||||
## Import to Any Platform
|
||||
## Credentials File Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"access_token": "your-access-token",
|
||||
"refresh_token": "your-refresh-token",
|
||||
"token_type": "Bearer",
|
||||
"resource_url": "portal.qwen.ai",
|
||||
"expiry_date": 1771774796531
|
||||
}
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
| Endpoint | URL |
|
||||
|----------|-----|
|
||||
| **API Base** | `https://dashscope.aliyuncs.com/compatible-mode/v1` |
|
||||
| **Chat Completions** | `/chat/completions` |
|
||||
| **Token Refresh** | `https://chat.qwen.ai/api/v1/oauth2/token` |
|
||||
|
||||
## Available Models (FREE Tier)
|
||||
|
||||
| Model | Best For |
|
||||
|-------|----------|
|
||||
| `qwen3-coder-plus` | Coding (recommended) |
|
||||
| `qwen3-coder-flash` | Fast coding |
|
||||
| `qwen-max` | Complex tasks |
|
||||
|
||||
## Import Methods
|
||||
|
||||
### ZeroClaw (Native Provider - Auto Token Refresh)
|
||||
|
||||
ZeroClaw has **built-in qwen-oauth provider** that handles token refresh automatically:
|
||||
|
||||
```bash
|
||||
# Configure ZeroClaw to use native qwen-oauth provider
|
||||
cat > ~/.zeroclaw/config.toml << EOF
|
||||
default_provider = "qwen-oauth"
|
||||
default_model = "qwen3-coder-plus"
|
||||
default_temperature = 0.7
|
||||
EOF
|
||||
|
||||
# ZeroClaw automatically:
|
||||
# • Reads ~/.qwen/oauth_creds.json
|
||||
# • Refreshes expired tokens using refresh_token
|
||||
# • Uses correct DashScope API endpoint
|
||||
|
||||
zeroclaw agent -m "Hello!"
|
||||
```
|
||||
|
||||
### Other Platforms (OpenAI-Compatible Import)
|
||||
|
||||
For OpenClaw, NanoBot, PicoClaw, NanoClaw - use OpenAI-compatible endpoint:
|
||||
|
||||
```bash
|
||||
# Extract token
|
||||
export QWEN_TOKEN=$(cat ~/.qwen/oauth-token.json | jq -r '.access_token')
|
||||
export OPENAI_API_KEY=$(cat ~/.qwen/oauth_creds.json | jq -r '.access_token')
|
||||
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||
|
||||
# Configure for any platform
|
||||
export OPENAI_API_KEY="$QWEN_TOKEN"
|
||||
export OPENAI_BASE_URL="https://api.qwen.ai/v1"
|
||||
export OPENAI_MODEL="qwen3-coder-plus"
|
||||
|
||||
# Use with any platform!
|
||||
# Use with any platform
|
||||
openclaw # OpenClaw with FREE Qwen
|
||||
nanobot # NanoBot with FREE Qwen
|
||||
picoclaw # PicoClaw with FREE Qwen
|
||||
zeroclaw # ZeroClaw with FREE Qwen
|
||||
nanoclaw # NanoClaw with FREE Qwen
|
||||
```
|
||||
|
||||
---
|
||||
@@ -87,7 +136,7 @@ zeroclaw # ZeroClaw with FREE Qwen
|
||||
|
||||
| Provider | Free Tier | Model | Setup |
|
||||
|----------|-----------|-------|-------|
|
||||
| **Qwen OAuth** | 2,000/day | Qwen3-Coder | `qwen && /auth` |
|
||||
| **Qwen OAuth** | 2,000/day | Qwen3-Coder | `qwen --auth-type qwen-oauth` |
|
||||
|
||||
## Tier 2: Major AI Labs
|
||||
|
||||
@@ -143,126 +192,29 @@ zeroclaw # ZeroClaw with FREE Qwen
|
||||
|
||||
---
|
||||
|
||||
# Multi-Provider Configuration
|
||||
|
||||
## Full Configuration Example
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": {
|
||||
"qwen_oauth": {
|
||||
"type": "oauth",
|
||||
"free": true,
|
||||
"daily_limit": 2000,
|
||||
"model": "qwen3-coder-plus"
|
||||
},
|
||||
"anthropic": {
|
||||
"apiKey": "${ANTHROPIC_API_KEY}",
|
||||
"baseURL": "https://api.anthropic.com"
|
||||
},
|
||||
"openai": {
|
||||
"apiKey": "${OPENAI_API_KEY}",
|
||||
"baseURL": "https://api.openai.com/v1"
|
||||
},
|
||||
"google": {
|
||||
"apiKey": "${GOOGLE_API_KEY}",
|
||||
"baseURL": "https://generativelanguage.googleapis.com/v1"
|
||||
},
|
||||
"azure": {
|
||||
"apiKey": "${AZURE_OPENAI_API_KEY}",
|
||||
"baseURL": "${AZURE_OPENAI_ENDPOINT}"
|
||||
},
|
||||
"vertex": {
|
||||
"projectId": "${GOOGLE_CLOUD_PROJECT}",
|
||||
"location": "${GOOGLE_CLOUD_LOCATION}"
|
||||
},
|
||||
"bedrock": {
|
||||
"region": "us-east-1",
|
||||
"accessKeyId": "${AWS_ACCESS_KEY_ID}",
|
||||
"secretAccessKey": "${AWS_SECRET_ACCESS_KEY}"
|
||||
},
|
||||
"openrouter": {
|
||||
"apiKey": "${OPENROUTER_API_KEY}",
|
||||
"baseURL": "https://openrouter.ai/api/v1"
|
||||
},
|
||||
"xai": {
|
||||
"apiKey": "${XAI_API_KEY}",
|
||||
"baseURL": "https://api.x.ai/v1"
|
||||
},
|
||||
"mistral": {
|
||||
"apiKey": "${MISTRAL_API_KEY}",
|
||||
"baseURL": "https://api.mistral.ai/v1"
|
||||
},
|
||||
"groq": {
|
||||
"apiKey": "${GROQ_API_KEY}",
|
||||
"baseURL": "https://api.groq.com/openai/v1"
|
||||
},
|
||||
"cerebras": {
|
||||
"apiKey": "${CEREBRAS_API_KEY}",
|
||||
"baseURL": "https://api.cerebras.ai/v1"
|
||||
},
|
||||
"deepinfra": {
|
||||
"apiKey": "${DEEPINFRA_API_KEY}",
|
||||
"baseURL": "https://api.deepinfra.com/v1"
|
||||
},
|
||||
"cohere": {
|
||||
"apiKey": "${COHERE_API_KEY}",
|
||||
"baseURL": "https://api.cohere.ai/v1"
|
||||
},
|
||||
"together": {
|
||||
"apiKey": "${TOGETHER_API_KEY}",
|
||||
"baseURL": "https://api.together.xyz/v1"
|
||||
},
|
||||
"perplexity": {
|
||||
"apiKey": "${PERPLEXITY_API_KEY}",
|
||||
"baseURL": "https://api.perplexity.ai"
|
||||
},
|
||||
"ollama": {
|
||||
"baseURL": "http://localhost:11434/v1",
|
||||
"apiKey": "ollama"
|
||||
}
|
||||
},
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model": "anthropic/claude-sonnet-4-5",
|
||||
"temperature": 0.7
|
||||
},
|
||||
"free": {
|
||||
"model": "qwen/qwen3-coder-plus"
|
||||
},
|
||||
"fast": {
|
||||
"model": "groq/llama-3.3-70b-versatile"
|
||||
},
|
||||
"local": {
|
||||
"model": "ollama/llama3.2:70b"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Fetch Available Models
|
||||
# Quick Import Script
|
||||
|
||||
```bash
|
||||
# OpenRouter - All 100+ models
|
||||
curl -s https://openrouter.ai/api/v1/models \
|
||||
-H "Authorization: Bearer $OPENROUTER_API_KEY" | jq '.data[].id'
|
||||
#!/bin/bash
|
||||
# Usage: source import-qwen-oauth.sh [platform]
|
||||
|
||||
# OpenAI - GPT models
|
||||
curl -s https://api.openai.com/v1/models \
|
||||
-H "Authorization: Bearer $OPENAI_API_KEY" | jq '.data[].id'
|
||||
CREDS_FILE="$HOME/.qwen/oauth_creds.json"
|
||||
PLATFORM="${1:-zeroclaw}"
|
||||
|
||||
# Groq - Fast inference models
|
||||
curl -s https://api.groq.com/openai/v1/models \
|
||||
-H "Authorization: Bearer $GROQ_API_KEY" | jq '.data[].id'
|
||||
QWEN_TOKEN=$(cat "$CREDS_FILE" | jq -r '.access_token')
|
||||
|
||||
# Ollama - Local models
|
||||
curl -s http://localhost:11434/api/tags | jq '.models[].name'
|
||||
|
||||
# Anthropic (static list)
|
||||
# claude-opus-4-5-20250219, claude-sonnet-4-5-20250219, claude-3-5-sonnet-20241022
|
||||
|
||||
# Google Gemini
|
||||
curl -s "https://generativelanguage.googleapis.com/v1/models?key=$GOOGLE_API_KEY"
|
||||
case "$PLATFORM" in
|
||||
zeroclaw)
|
||||
# Native provider - just set config
|
||||
sed -i 's/^default_provider = .*/default_provider = "qwen-oauth"/' ~/.zeroclaw/config.toml
|
||||
sed -i 's/^default_model = .*/default_model = "qwen3-coder-plus"/' ~/.zeroclaw/config.toml
|
||||
;;
|
||||
*)
|
||||
# OpenAI-compatible
|
||||
export OPENAI_API_KEY="$QWEN_TOKEN"
|
||||
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
|
||||
;;
|
||||
esac
|
||||
```
|
||||
|
||||
---
|
||||
@@ -272,7 +224,7 @@ curl -s "https://generativelanguage.googleapis.com/v1/models?key=$GOOGLE_API_KEY
|
||||
## Qwen Code (Native FREE OAuth)
|
||||
```bash
|
||||
npm install -g @qwen-code/qwen-code@latest
|
||||
qwen && /auth
|
||||
qwen --auth-type qwen-oauth -p "test"
|
||||
```
|
||||
|
||||
## OpenClaw
|
||||
@@ -313,8 +265,24 @@ chmod +x zeroclaw-linux-amd64 && sudo mv zeroclaw-linux-amd64 /usr/local/bin/zer
|
||||
|
||||
---
|
||||
|
||||
# Automation Scripts
|
||||
# Troubleshooting
|
||||
|
||||
See `scripts/` directory:
|
||||
- `import-qwen-oauth.sh` - Import FREE Qwen OAuth to any platform
|
||||
- `fetch-models.sh` - Fetch available models from all providers
|
||||
## Token Expired
|
||||
|
||||
```bash
|
||||
# ZeroClaw: Automatic refresh (no action needed)
|
||||
|
||||
# Other platforms: Re-authenticate and re-export
|
||||
qwen --auth-type qwen-oauth -p "test"
|
||||
export OPENAI_API_KEY=$(cat ~/.qwen/oauth_creds.json | jq -r '.access_token')
|
||||
```
|
||||
|
||||
## API Test
|
||||
|
||||
```bash
|
||||
QWEN_TOKEN=$(cat ~/.qwen/oauth_creds.json | jq -r '.access_token')
|
||||
curl -X POST "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions" \
|
||||
-H "Authorization: Bearer $QWEN_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model": "qwen3-coder-plus", "messages": [{"role": "user", "content": "Hello"}]}'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user