Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4cff902
Add Claude Code integration script and documentation
codegen-sh[bot] Oct 7, 2025
2489435
Upgrade to GLM-4.6 and add GLM-4.5V vision support
codegen-sh[bot] Oct 7, 2025
f04d8a7
Add upgrade summary documentation
codegen-sh[bot] Oct 7, 2025
784e0c7
Add comprehensive validation report
codegen-sh[bot] Oct 7, 2025
97a9d4e
Update README.md
Zeeeepa Oct 7, 2025
268203f
Merge pull request #5 from Zeeeepa/CC
Zeeeepa Oct 7, 2025
49f21e8
Add comprehensive dependency installation to zai_cc.py
codegen-sh[bot] Oct 7, 2025
c34265b
Update zai_cc.py
Zeeeepa Oct 7, 2025
2f91554
Update model mappings to include GLM-4.6 and GLM-4.5V
codegen-sh[bot] Oct 7, 2025
cf0469b
Add zai_cc.py - Claude Code integration test script
codegen-sh[bot] Oct 7, 2025
058f2d3
Add .env.example with comprehensive configuration guide
codegen-sh[bot] Oct 7, 2025
1ac6139
Upgrade zai_cc.py to standalone launcher with full lifecycle management
codegen-sh[bot] Oct 7, 2025
59c479d
Add comprehensive documentation for zai_cc.py launcher
codegen-sh[bot] Oct 7, 2025
2c02896
Update zai_cc.py
Zeeeepa Oct 7, 2025
f9fb948
Add complete ZAI.js transformer plugin to deployment
codegen-sh[bot] Oct 7, 2025
406bc7a
Fix critical bug in zai_cc.py: create_env_file() now generates properโ€ฆ
codegen-sh[bot] Oct 7, 2025
116ec91
Update zai_cc.py
Zeeeepa Oct 7, 2025
d1ad60a
Add comprehensive test_all.py validation suite for all 7 Z.AI models
codegen-sh[bot] Oct 7, 2025
1a2d43f
โšก Upgrade test_all.py to async concurrent testing
codegen-sh[bot] Oct 7, 2025
08cc0a6
๐Ÿ”ง Fix Z.AI API version header (prod-fe-1.0.79 โ†’ 1.0.95)
codegen-sh[bot] Oct 7, 2025
c24192b
๐Ÿ” Add automated Z.AI login script with Playwright
codegen-sh[bot] Oct 7, 2025
d476975
fix: Update X-FE-Version to prod-fe-1.0.76 (verified working version)
codegen-sh[bot] Oct 7, 2025
f184442
feat: Add zai_cc.py Claude Code bridge (WIP)
codegen-sh[bot] Oct 7, 2025
7d3de36
feat: Implement two-step chat creation flow in zai_cc.py
codegen-sh[bot] Oct 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 76 additions & 46 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,60 +1,90 @@
# ไปฃ็†ๆœๅŠก้…็ฝฎๆ–‡ไปถ็คบไพ‹
# ๅคๅˆถๆญคๆ–‡ไปถไธบ .env ๅนถๆ นๆฎ้œ€่ฆไฟฎๆ”น้…็ฝฎๅ€ผ
# Z.AI API Configuration Example
# Copy this file to .env and configure as needed

# ========== API ๅŸบ็ก€้…็ฝฎ ==========
# ๅฎขๆˆท็ซฏ่ฎค่ฏๅฏ†้’ฅ๏ผˆๆ‚จ่‡ชๅฎšไน‰็š„ API ๅฏ†้’ฅ๏ผŒ็”จไบŽๅฎขๆˆท็ซฏ่ฎฟ้—ฎๆœฌๆœๅŠก๏ผ‰
AUTH_TOKEN=sk-your-api-key

# ่ทณ่ฟ‡ๅฎขๆˆท็ซฏ่ฎค่ฏ๏ผˆไป…ๅผ€ๅ‘็Žฏๅขƒไฝฟ็”จ๏ผ‰
SKIP_AUTH_TOKEN=false

# ========== Z.ai Tokenๆฑ ้…็ฝฎ ==========
# Tokenๅคฑ่ดฅ้˜ˆๅ€ผ๏ผˆๅคฑ่ดฅๅคšๅฐ‘ๆฌกๅŽๆ ‡่ฎฐไธบไธๅฏ็”จ๏ผ‰
TOKEN_FAILURE_THRESHOLD=3

# Tokenๆขๅค่ถ…ๆ—ถๆ—ถ้—ด๏ผˆ็ง’๏ผŒๅคฑ่ดฅtokenๅœจๆญคๆ—ถ้—ดๅŽ้‡ๆ–ฐๅฐ่ฏ•๏ผ‰
TOKEN_RECOVERY_TIMEOUT=1800
# ============================================================================
# Server Configuration
# ============================================================================
LISTEN_PORT=8080
DEBUG_LOGGING=true

# Tokenๅฅๅบทๆฃ€ๆŸฅ้—ด้š”๏ผˆ็ง’๏ผŒๅฎšๆœŸๆฃ€ๆŸฅtoken็Šถๆ€๏ผ‰
TOKEN_HEALTH_CHECK_INTERVAL=300
# ============================================================================
# Authentication Configuration
# ============================================================================

# Z.AI ๅŒฟๅ็”จๆˆทๆจกๅผ
# false: ไฝฟ็”จ่ฎค่ฏ Token ไปค็‰Œ๏ผŒๅคฑ่ดฅๆ—ถ่‡ชๅŠจ้™็บงไธบๅŒฟๅ่ฏทๆฑ‚
# true: ่‡ชๅŠจไปŽ Z.ai ่Žทๅ–ไธดๆ—ถ่ฎฟ้—ฎไปค็‰Œ๏ผŒ้ฟๅ…ๅฏน่ฏๅކๅฒๅ…ฑไบซ
# Anonymous Mode - Automatically gets visitor token from Z.AI
ANONYMOUS_MODE=true

# ========== Z.ai ่ฎค่ฏtoken้…็ฝฎ๏ผˆๅฏ้€‰๏ผ‰ ===========
# ไฝฟ็”จ็‹ฌ็ซ‹็š„tokenๆ–‡ไปถ้…็ฝฎ๏ผˆๅฏ้€‰๏ผ‰
# ๅฆ‚ๆžœ้œ€่ฆ่ฎค่ฏtoken๏ผŒๅœจ้กน็›ฎๆ น็›ฎๅฝ•ๅˆ›ๅปบ tokens.txt ๆ–‡ไปถ๏ผŒๆฏ่กŒไธ€ไธชtokenๆˆ–้€—ๅทๅˆ†้š”
# ๅฆ‚ๆžœไธ้œ€่ฆ่ฎค่ฏtoken๏ผŒๆƒณ่ตฐๅŒฟๅ่ฏทๆฑ‚ๆจกๅผ๏ผŒๅฏไปฅๆณจ้‡Šๆމๆˆ–ๅˆ ้™คๆญค้…็ฝฎ้กน
# AUTH_TOKENS_FILE=tokens.txt
# Skip API Key Validation - Recommended for local development
# Set to true to bypass AUTH_TOKEN validation
SKIP_AUTH_TOKEN=true

# ========== LongCat ้…็ฝฎ ==========
# LongCat passport token๏ผˆๅ•ไธชtoken๏ผ‰
# LONGCAT_PASSPORT_TOKEN=your_passport_token_here
# API Authentication Token (optional if SKIP_AUTH_TOKEN=true)
# Leave empty for anonymous mode
AUTH_TOKEN=

# LongCat tokens ๆ–‡ไปถ่ทฏๅพ„๏ผˆๅคšไธชtoken๏ผ‰
# LONGCAT_TOKENS_FILE=longcat_tokens.txt
# ============================================================================
# Model Configuration
# ============================================================================

# ========== ๆœๅŠกๅ™จ้…็ฝฎ ==========
# ๆœๅŠก็›‘ๅฌ็ซฏๅฃ
LISTEN_PORT=8080
# GLM-4.5 Series (128K context)
PRIMARY_MODEL=GLM-4.5
THINKING_MODEL=GLM-4.5-Thinking
SEARCH_MODEL=GLM-4.5-Search
AIR_MODEL=GLM-4.5-Air

# ๆœๅŠกๅ็งฐ๏ผˆ็”จไบŽ่ฟ›็จ‹ๅ”ฏไธ€ๆ€ง้ชŒ่ฏ๏ผ‰
SERVICE_NAME=z-ai2api-server
# GLM-4.6 Series (200K context)
GLM46_MODEL=GLM-4.6
GLM46_THINKING_MODEL=GLM-4.6-Thinking
GLM46_SEARCH_MODEL=GLM-4.6-Search

# ่ฐƒ่ฏ•ๆ—ฅๅฟ—
DEBUG_LOGGING=false
# ============================================================================
# Feature Flags
# ============================================================================

# Function Call ๅŠŸ่ƒฝๅผ€ๅ…ณ
# Enable tool/function calling support
TOOL_SUPPORT=true

# ๅทฅๅ…ท่ฐƒ็”จๆ‰ซๆ้™ๅˆถ๏ผˆๅญ—็ฌฆๆ•ฐ๏ผ‰
SCAN_LIMIT=200000

# ========== Z.AI ้”™่ฏฏ็ 400ๅค„็† ==========
# ============================================================================
# Advanced Configuration (Optional)
# ============================================================================

# LongCat Configuration (if using LongCat provider)
# LONGCAT_PASSPORT_TOKEN=your_token_here
# LONGCAT_TOKENS_FILE=/path/to/tokens.txt

# K2-Think Configuration (if using K2-Think provider)
# K2THINK_API_KEY=your_api_key_here

# ============================================================================
# Usage Instructions
# ============================================================================

# 1. Copy this file to .env:
# cp .env.example .env

# 2. Start the server:
# python main.py

# 3. Test with Claude Code integration:
# python zai_cc.py

# 4. Configure Claude Code (.claude-code-router/config.js):
# {
# "Providers": [
# {
# "name": "GLM",
# "api_base_url": "http://127.0.0.1:8080/v1/chat/completions",
# "api_key": "sk-dummy",
# "models": ["GLM-4.5", "GLM-4.6", "GLM-4.5V"]
# }
# ]
# }

# 5. Available Models:
# - GLM-4.5 : Flagship model (128K context)
# - GLM-4.5-Air : Fast & lightweight (128K context)
# - GLM-4.6 : Extended context (200K tokens)
# - GLM-4.5V : Vision/multimodal model
# - GLM-4.5-Thinking: Reasoning optimized
# - GLM-4.5-Search : Web search enhanced

# ้‡่ฏ•ๆฌกๆ•ฐ
MAX_RETRIES=6
# ๅˆๅง‹้‡่ฏ•ๅปถ่ฟŸ
RETRY_DELAY=1
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@

```bash
# ๅ…‹้š†้กน็›ฎ
curl -LsSf https://astral.sh/uv/install.sh | sh
sudo apt update
sudo apt install python3-pip
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
source $HOME/.local/bin/env
git clone https://github.com/ZyphrZero/z.ai2api_python.git
cd z.ai2api_python

# ไฝฟ็”จ uv (ๆŽจ่)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
uv run python main.py

# ๆˆ–ไฝฟ็”จ pip (ๆŽจ่ไฝฟ็”จๆธ…ๅŽๆบ)
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
python main.py
```
Expand Down
Loading