Files
ClaudeCode-Custom-Skills/skills/claw-setup/SKILL.md
Claude Code fb1f68015a 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>
2026-02-22 05:07:51 -05:00

289 lines
9.9 KiB
Markdown

---
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: 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
```
┌─────────────────────────────────────────────────────────────────┐
│ CLAW SETUP FEATURES │
├─────────────────────────────────────────────────────────────────┤
│ │
│ FEATURE 1: Qwen OAuth Cross-Platform Import (FREE) │
│ ─────────────────────────────────────────────────── │
│ • FREE: 2,000 requests/day, 60 req/min │
│ • 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 │
│ ───────────────────────────────────────────────── │
│ • All major AI labs: Anthropic, OpenAI, Google, xAI, Mistral │
│ • Cloud platforms: Azure, AWS Bedrock, Google Vertex │
│ • Fast inference: Groq, Cerebras │
│ • Gateways: OpenRouter (100+ models), Together AI │
│ • Local: Ollama, LM Studio, vLLM │
│ │
└─────────────────────────────────────────────────────────────────┘
```
## Supported Platforms
| 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 |
| **NanoClaw** | TypeScript | ~50MB | ✅ Import | ✅ | WhatsApp |
---
# FEATURE 1: Qwen OAuth Cross-Platform Import (FREE)
## Get FREE Qwen OAuth
```bash
# Install Qwen Code CLI
npm install -g @qwen-code/qwen-code@latest
# 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
```
## 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 OPENAI_API_KEY=$(cat ~/.qwen/oauth_creds.json | jq -r '.access_token')
export OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
# Use with any platform
openclaw # OpenClaw with FREE Qwen
nanobot # NanoBot with FREE Qwen
picoclaw # PicoClaw with FREE Qwen
nanoclaw # NanoClaw with FREE Qwen
```
---
# FEATURE 2: 25+ OpenCode-Compatible AI Providers
## Tier 1: FREE Tier
| Provider | Free Tier | Model | Setup |
|----------|-----------|-------|-------|
| **Qwen OAuth** | 2,000/day | Qwen3-Coder | `qwen --auth-type qwen-oauth` |
## Tier 2: Major AI Labs
| Provider | SDK Package | Key Models | Features |
|----------|-------------|------------|----------|
| **Anthropic** | `@ai-sdk/anthropic` | Claude 3.5/4/Opus | Extended thinking, PDF support |
| **OpenAI** | `@ai-sdk/openai` | GPT-4o, o1, o3, GPT-5 | Function calling, structured output |
| **Google AI** | `@ai-sdk/google` | Gemini 2.5, Gemini 3 Pro | Multimodal, long context |
| **xAI** | `@ai-sdk/xai` | Grok models | Real-time data integration |
| **Mistral** | `@ai-sdk/mistral` | Mistral Large, Codestral | Code-focused models |
## Tier 3: Cloud Platforms
| Provider | SDK Package | Models | Features |
|----------|-------------|--------|----------|
| **Azure OpenAI** | `@ai-sdk/azure` | GPT-5 Enterprise | Azure integration, custom endpoints |
| **Google Vertex** | `@ai-sdk/google-vertex` | Claude, Gemini on GCP | Anthropic on Google infrastructure |
| **Amazon Bedrock** | `@ai-sdk/amazon-bedrock` | Nova, Claude, Llama 3 | AWS credentials, regional prefixes |
## Tier 4: Aggregators & Gateways
| Provider | SDK Package | Models | Features |
|----------|-------------|--------|----------|
| **OpenRouter** | `@openrouter/ai-sdk-provider` | 100+ models | Multi-provider gateway |
| **Vercel AI** | `@ai-sdk/vercel` | Multi-provider | Edge hosting, rate limiting |
| **Together AI** | `@ai-sdk/togetherai` | Open source models | Fine-tuning, hosting |
| **DeepInfra** | `@ai-sdk/deepinfra` | Open source | Cost-effective hosting |
## Tier 5: Fast Inference
| Provider | SDK Package | Speed | Models |
|----------|-------------|-------|--------|
| **Groq** | `@ai-sdk/groq` | Ultra-fast | Llama 3, Mixtral |
| **Cerebras** | `@ai-sdk/cerebras` | Fastest | Llama 3 variants |
## Tier 6: Specialized
| Provider | SDK Package | Use Case |
|----------|-------------|----------|
| **Perplexity** | `@ai-sdk/perplexity` | Web search integration |
| **Cohere** | `@ai-sdk/cohere` | Enterprise RAG |
| **GitLab Duo** | `@gitlab/gitlab-ai-provider` | CI/CD AI integration |
| **GitHub Copilot** | Custom | IDE integration |
## Tier 7: Local/Self-Hosted
| Provider | Base URL | Use Case |
|----------|----------|----------|
| **Ollama** | localhost:11434 | Local model hosting |
| **LM Studio** | localhost:1234 | GUI local models |
| **vLLM** | localhost:8000 | High-performance serving |
| **LocalAI** | localhost:8080 | OpenAI-compatible local |
---
# Quick Import Script
```bash
#!/bin/bash
# Usage: source import-qwen-oauth.sh [platform]
CREDS_FILE="$HOME/.qwen/oauth_creds.json"
PLATFORM="${1:-zeroclaw}"
QWEN_TOKEN=$(cat "$CREDS_FILE" | jq -r '.access_token')
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
```
---
# Platform Installation
## Qwen Code (Native FREE OAuth)
```bash
npm install -g @qwen-code/qwen-code@latest
qwen --auth-type qwen-oauth -p "test"
```
## OpenClaw
```bash
git clone https://github.com/openclaw/openclaw.git
cd openclaw && npm install && npm run setup
```
## NanoBot
```bash
pip install nanobot-ai && nanobot onboard
```
## PicoClaw
```bash
wget https://github.com/sipeed/picoclaw/releases/latest/picoclaw-linux-amd64
chmod +x picoclaw-linux-amd64 && sudo mv picoclaw-linux-amd64 /usr/local/bin/picoclaw
```
## ZeroClaw
```bash
wget https://github.com/zeroclaw-labs/zeroclaw/releases/latest/zeroclaw-linux-amd64
chmod +x zeroclaw-linux-amd64 && sudo mv zeroclaw-linux-amd64 /usr/local/bin/zeroclaw
```
---
# Usage Examples
```
"Setup OpenClaw with FREE Qwen OAuth"
"Configure NanoBot with all AI providers"
"Import Qwen OAuth to ZeroClaw"
"Fetch available models from OpenRouter"
"Setup Claw with Anthropic and OpenAI providers"
"Add custom model to my Claw setup"
```
---
# Troubleshooting
## 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"}]}'
```