π¨π³ Chinese | πΊπΈ English
A comprehensive collection of practical AI-related scripts designed to simplify AI development workflows and automate common tasks.
WXn8n is an intelligent bot that connects WeChat with N8N workflow platform, supporting:
- π N8N Integration - Seamless connection with N8N workflow platform
- π¬ Smart Conversations - AI-powered intelligent replies for text messages
- π File Processing - Automatic handling of images, documents, and other file types
- π₯ Group Management - Group chat permission control and user management
- β‘ Command System - Rich built-in command functionality (/help, /ps, etc.)
- π Real-time Monitoring - Real-time monitoring of specified users and groups
- π‘οΈ Security Authentication - Webhook authentication and permission control support
graph TD
A["Receive Message"] --> B["MessageContext"]
B --> C["process_message()"]
C --> D{File Message?}
D -->|Yes| E["MessageHandler.handle_file_message()"]
E --> F["Save File and Reply"]
D -->|No| G{Group Permission Check}
G -->|No Permission| H["Silent Processing"]
G -->|Has Permission| I{Is Command?}
I -->|Yes| J["CommandSystem.has_command()"]
J -->|Found| K["CommandSystem.execute_command()"]
J -->|Not Found| L["ResponseManager.handle_unknown_command()"]
I -->|No| M["MessageHandler.build_content()"]
M --> N["ResponseManager.send_ai_response()"]
K --> O{"/ps Command?"}
K --> P{"/help Command?"}
K --> Q["Other Commands..."]
O --> R["handle_ps_command()"]
P --> S["handle_help_command()"]
style A fill:#e1f5fe
style C fill:#f3e5f5
style J fill:#e8f5e8
style R fill:#fff3e0
style S fill:#fff3e0
- Automatic message type recognition (text, images, files, etc.)
- Support for both group and private chat scenarios
- Smart permission management and user whitelist
- Webhook Triggers: Seamless integration with N8N via webhooks
- File Upload: Support for sending files to N8N for processing
- Response Handling: Automatic processing of N8N results and files
- Environment variable configuration support
- Support for test and production environment switching
- Configurable monitoring user and group lists
- Custom timeout and authentication settings
# Navigate to project directory
cd AICode/wxn8n
# Install dependencies (using uv package manager)
uv sync# Copy configuration template
cp config.env.template config.env
# Edit configuration file
# Configure N8N Webhook URL, monitoring user list, etc.# Activate virtual environment and run
uv run python main.py# Basic Configuration
SAVE_PATH= # File save path
LOG_LEVEL=INFO # Log level
LISTEN_INTERVAL=1 # Listening interval
# N8N Integration Configuration
WEBHOOK_TEST_URL= # Test environment Webhook URL
WEBHOOK_PROD_URL= # Production environment Webhook URL
AUTH_HEADER_KEY= # Authentication header key
AUTH_HEADER_VALUE= # Authentication header value
# Monitoring Configuration
LISTEN_USERS= # Monitoring user list (comma-separated)
LISTEN_GROUPS= # Monitoring group list (comma-separated)
GROUP_PLUS_USERS= # Group privileged user list
# Timeout Settings
REQUEST_TIMEOUT=300 # Request timeout
IMG_DOWNLOAD_TIMEOUT=30 # Image download timeout- Python: 3.12+
- Dependencies: wxauto>=39.1.15
- System: Windows (WeChat PC version)
- N8N: Configured N8N workflow instance
This is a toolset for automating the deployment of Claude Code and Claude Code Proxy, with support for:
- β Auto Dependency Installation - Detects and installs uv, npm, and Claude Code
- π Proxy Service Management - Automatically installs and configures Claude Code Proxy
- π One-Click Start - Configures environment variables and starts the services
- β‘ Port Conflict Handling - Intelligently detects and resolves port occupation issues
- π§ Configuration Management - Automatically configures the .env file and environment variables
- π Cross-Platform Support - Supports Windows, macOS, and Linux
| System | Script File | Description |
|---|---|---|
| π§ Linux/macOS | Claude_code_proxy.sh |
Bash script for Unix-like systems |
| πͺ Windows | Claude_code_proxy.ps1 |
PowerShell script for Windows |
copilot-api is a proxy service that forwards GitHub Copilot API calls to Claude Code, supporting:
- π API Proxy Forwarding - Seamlessly forwards GitHub Copilot API calls to Claude Code
- π GitHub Authentication - Supports GitHub device authorization flow
- π― Model Mapping - Automatically maps GitHub Copilot models to corresponding Claude models
- β‘ Local Deployment - Runs proxy service locally for privacy protection
- π οΈ Simple Configuration - One-click installation and configuration for quick setup
- π High Compatibility - Fully compatible with GitHub Copilot API interface
graph LR
A["GitHub Copilot Client"] --> B["copilot-api Proxy Service<br/>(localhost:4141)"]
B --> C["Claude Code"]
C --> D["Claude API"]
style B fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
Ensure Node.js is installed on your system, then install the required tools:
# Install copilot-api
npm install -g copilot-api
# Install Claude Code
npm install -g @anthropic-ai/claude-codeOpen the first terminal and start the proxy service:
copilot-api startThe system will prompt for GitHub authorization. Follow the instructions to visit the page and enter the device code to complete authorization.
Add configuration to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "http://localhost:4141",
"ANTHROPIC_AUTH_TOKEN": "dummy",
"ANTHROPIC_MODEL": "claude-sonnet-4",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-3.7-sonnet",
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}In the second terminal, execute:
claude- Node.js: 16.0+
- GitHub Account: Requires GitHub Copilot access permissions
- Network Connection: Stable internet connection for authentication
git clone https://github.com/sylearn/AICode.git
cd AICode/Claude_Code# Grant execution permission to the script
chmod +x Claude_code_proxy.sh
# Run the script
./Claude_code_proxy.sh# Run PowerShell as Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Run the script
.\Claude_code_proxy.ps1The script will automatically detect your environment and guide you through the configuration process.
- Checks if Node.js and npm are installed
- Checks if the Python package manager uv is installed
- Checks if Claude Code is already installed
- Checks if Git is available
- uv Installation: Automatically installs the Python package manager from the official source
- Claude Code Installation: Installs Claude Code globally via npm
- Proxy Service Installation: Automatically clones and configures Claude Code Proxy
- Automatically generates and updates the
.envconfiguration file - Intelligently detects the local IP address
- Automatically configures proxy server parameters
- Supports custom model and API configurations
- Automatically detects port usage status
- Intelligently identifies and terminates conflicting processes
- Supports interactive user choices for handling conflicts
- Operating System: Windows 10+, macOS 10.14+, Linux (Ubuntu 18.04+)
- Network: A stable internet connection
- Permissions: Administrator privileges (for installing dependencies)
| Software | Version Requirement | Auto-Install | Notes |
|---|---|---|---|
| Node.js | 16.0+ | β | Requires manual installation |
| npm | 8.0+ | β | Installed with Node.js |
| Git | 2.0+ | β | Requires manual installation |
| uv | Latest | β | Script will install automatically |
| Claude Code | Latest | β | Script will install automatically |
-
Prepare Your Environment
- Ensure Node.js and Git are installed
- Have your OpenAI API Key ready
- Have your API Base URL ready
-
Run the Script
- Download and run the script for your operating system
- The script will auto-detect the environment and install any missing dependencies
-
Configure Parameters
- The script will prompt you to enter API configuration details
- Alternatively, you can directly modify the configuration variables at the top of the script
If initialization is complete, simply run the script to start the services:
# Linux/macOS
./Claude_code_proxy.sh
# Windows
.\Claude_code_proxy.ps1Press Ctrl+C to stop the Claude Code client, and the proxy service will stop automatically.
# Script Configuration Area (at the top of the script file)
CLAUDE_COMMAND="claude" # Claude Code command name
CLAUDE_DIR="$HOME/.claude" # Claude Code configuration directory
PROXY_PORT=8082 # Proxy service port# API-related configuration
OPENAI_API_KEY="your-api-key-here" # Your OpenAI API Key
OPENAI_BASE_URL="https://api.openai.com/v1" # API Base URL
BIG_MODEL="claude-sonnet-4" # Large model name
SMALL_MODEL="gpt-4o-mini" # Small model name# Proxy service configuration
HOST="0.0.0.0" # Service listening address
MAX_TOKENS_LIMIT=32000 # Max token limitοΌ< 32000οΌ
REQUEST_TIMEOUT=90 # Request timeout
MAX_RETRIES=3 # Max retriesThe script will automatically set the following environment variables:
CLAUDE_CODE_MAX_OUTPUT_TOKENS: Max output tokensANTHROPIC_BASE_URL: Proxy service addressANTHROPIC_AUTH_TOKEN: Proxy authentication token
Issue: Permission denied error during dependency installation
Solution:
# Linux/macOS
sudo ./Claude_code_proxy.sh
# Windows (Run PowerShell as Administrator)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserIssue: API Error (401 Invalid API key)
[L] API Error (401 {"detail":"Invalid API key. Please provide a valid Anthropic API key."}) Retrying in 1 second
...
2025-07-14 16:03:56,450 - WARNING - Invalid API key provided by client
Solution:
# Check your .env file
cat ~/.claude/proxy/claude-code-proxy/.envComment out ANTHROPIC_API_KEY="your-expected-anthropic-api-key"
or manually navigate to the ~/.claude/proxy/claude-code-proxy directory and comment out the ANTHROPIC_API_KEY line in the .env file.
To enable debugging, you can change the log level in the script:
LOG_LEVEL="DEBUG" # Change the log level to DEBUGIf you need to perform a complete reinstallation:
# Clean up Claude Code Proxy
rm -rf ~/.claude/proxy
# Reinstall Claude Code
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-codeAICode/
βββ Claude_Code/
β βββ Claude_code_proxy.sh # Linux/macOS script
β βββ Claude_code_proxy.ps1 # Windows script
β βββ copilot_api.md # Copilot-API proxy service configuration guide
βββ wxn8n/ # WXn8n WeChat Bot
β βββ assets/ # Asset files
β βββ config.env.template # Configuration template
β βββ config.py # Configuration management
β βββ connect_n8n.py # N8N connection module
β βββ main.py # Main program entry
β βββ wechat_msg.py # WeChat message processing
β βββ pyproject.toml # Python project configuration
β βββ uv.lock # Dependency lock file
β βββ README.md # Project documentation
βββ README.md # English documentation
βββ README_CN.md # Chinese documentation
βββ License # MIT License
βββ .gitignore # Git ignore file
We welcome your contributions! Please follow these steps:
- Fork this repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Thank you for your support! π