Skip to content

Commit e6dbe6e

Browse files
author
张文超
committed
feat:增加cli、release
1 parent b6e0b5a commit e6dbe6e

File tree

7 files changed

+753
-11
lines changed

7 files changed

+753
-11
lines changed

.github/workflows/release.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v4
16+
with:
17+
go-version: '1.21'
18+
19+
- name: Get version
20+
id: version
21+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
22+
23+
- name: Build binaries
24+
run: |
25+
# Create release directory
26+
mkdir -p release
27+
28+
# Build flags
29+
VERSION=${{ steps.version.outputs.VERSION }}
30+
COMMIT_HASH=$(git rev-parse --short HEAD)
31+
BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
32+
LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT_HASH} -X main.buildTime=${BUILD_TIME} -s -w"
33+
34+
# Build for different platforms
35+
platforms=(
36+
"linux/amd64"
37+
"linux/arm64"
38+
"darwin/amd64"
39+
"darwin/arm64"
40+
"windows/amd64"
41+
"windows/arm64"
42+
)
43+
44+
for platform in "${platforms[@]}"; do
45+
IFS='/' read -r GOOS GOARCH <<< "$platform"
46+
47+
case $GOOS in
48+
"linux")
49+
OS_NAME="Linux"
50+
;;
51+
"darwin")
52+
OS_NAME="Darwin"
53+
;;
54+
"windows")
55+
OS_NAME="Windows"
56+
;;
57+
esac
58+
59+
case $GOARCH in
60+
"amd64")
61+
ARCH_NAME="x86_64"
62+
;;
63+
"arm64")
64+
ARCH_NAME="arm64"
65+
;;
66+
esac
67+
68+
output_name="claudeproxy_${OS_NAME}_${ARCH_NAME}"
69+
if [ $GOOS = "windows" ]; then
70+
output_name+='.exe'
71+
fi
72+
73+
echo "Building for $GOOS/$GOARCH -> $output_name"
74+
75+
env GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build \
76+
-ldflags="${LDFLAGS}" \
77+
-o release/${output_name} \
78+
main.go
79+
done
80+
81+
- name: Create Release
82+
uses: softprops/action-gh-release@v1
83+
with:
84+
tag_name: ${{ steps.version.outputs.VERSION }}
85+
name: Claude Code Proxy ${{ steps.version.outputs.VERSION }}
86+
body: |
87+
# Claude Code Proxy ${{ steps.version.outputs.VERSION }}
88+
89+
## 🎉 新特性
90+
- 提供 OpenAI 兼容的 API 接口
91+
- 支持 Claude 3.5 Sonnet 模型
92+
- 支持流式响应
93+
- 支持多种部署方式
94+
95+
## 📦 安装方式
96+
97+
### 快速安装(推荐)
98+
99+
**Linux/macOS:**
100+
```bash
101+
sudo curl -o /usr/local/bin/claudeproxy -L https://github.com/${{ github.repository }}/releases/latest/download/claudeproxy_$(uname -s)_$(uname -m)
102+
sudo chmod +x /usr/local/bin/claudeproxy
103+
```
104+
105+
**Windows (PowerShell):**
106+
```powershell
107+
Invoke-WebRequest -Uri "https://github.com/${{ github.repository }}/releases/latest/download/claudeproxy_Windows_x86_64.exe" -OutFile "claudeproxy.exe"
108+
```
109+
110+
### 使用安装脚本
111+
```bash
112+
curl -fsSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | bash
113+
```
114+
115+
### 手动下载
116+
117+
选择适合您系统的二进制文件:
118+
119+
- **Linux x86_64**: claudeproxy_Linux_x86_64
120+
- **Linux ARM64**: claudeproxy_Linux_arm64
121+
- **macOS Intel**: claudeproxy_Darwin_x86_64
122+
- **macOS Apple Silicon**: claudeproxy_Darwin_arm64
123+
- **Windows x86_64**: claudeproxy_Windows_x86_64.exe
124+
- **Windows ARM64**: claudeproxy_Windows_arm64.exe
125+
126+
## 🚀 使用方法
127+
128+
1. 配置 API 密钥:
129+
```bash
130+
claudeproxy setup
131+
```
132+
133+
2. 启动服务:
134+
```bash
135+
claudeproxy start
136+
```
137+
138+
3. 使用 OpenAI 兼容的 API:
139+
```bash
140+
curl -X POST http://localhost:8080/v1/chat/completions \
141+
-H "Content-Type: application/json" \
142+
-H "Authorization: Bearer your-api-key" \
143+
-d '{
144+
"model": "claude-3-5-sonnet-20241022",
145+
"messages": [
146+
{"role": "user", "content": "Hello!"}
147+
]
148+
}'
149+
```
150+
151+
## 📋 系统要求
152+
153+
- 操作系统: Linux, macOS, Windows
154+
- 架构: x86_64, ARM64
155+
- 网络: 需要访问 Anthropic API
156+
157+
## 🔧 配置说明
158+
159+
详细配置说明请参考项目文档。
160+
161+
---
162+
163+
**完整源代码**: https://github.com/${{ github.repository }}
164+
**问题反馈**: https://github.com/${{ github.repository }}/issues
165+
**使用文档**: https://github.com/${{ github.repository }}/blob/main/README.md
166+
files: |
167+
release/*
168+
draft: false
169+
prerelease: false
170+
env:
171+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
# Python
1+
# Go
2+
# Binaries for programs and plugins
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
claudeproxy
9+
# Test binary, built with `go test -c`
10+
*.test
11+
12+
# Output of the go coverage tool, specifically when used with LiteIDE
13+
*.out
14+
15+
# Go workspace file
16+
go.work
17+
18+
# Build artifacts
19+
dist/
20+
release/
21+
build/
22+
*.tar.gz
23+
*.zip
24+
25+
# Python (if any)
226
__pycache__/
327
*.py[cod]
428
*$py.class
5-
*.so
629
*.jsonl
730
.Python
8-
build/
931
develop-eggs/
10-
dist/
1132
downloads/
1233
eggs/
1334
.eggs/
@@ -34,6 +55,7 @@ ENV/
3455
*.swo
3556
.DS_Store
3657
CLAUDE.md
58+
3759
# Testing
3860
.coverage
3961
htmlcov/
@@ -42,6 +64,8 @@ coverage/
4264

4365
# Environment variables
4466
.env
67+
.env.local
68+
.env.production
4569

4670
# Logs
4771
*.log
@@ -51,6 +75,42 @@ conversion_log.jsonl
5175
# Docker
5276
.dockerignore
5377

78+
# Temporary files
79+
*.tmp
80+
*.temp
81+
release-notes.md
82+
83+
# OS generated files
84+
Thumbs.db
85+
ehthumbs.db
86+
Desktop.ini
87+
$RECYCLE.BIN/
88+
89+
# macOS
90+
.DS_Store
91+
.AppleDouble
92+
.LSOverride
93+
._*
94+
95+
# Windows
96+
Thumbs.db
97+
ehthumbs.db
98+
Desktop.ini
99+
$RECYCLE.BIN/
100+
*.cab
101+
*.msi
102+
*.msix
103+
*.msm
104+
*.msp
105+
106+
# Linux
107+
*~
108+
109+
# Backup files
110+
*.bak
111+
*.backup
112+
*.old
113+
54114
# Misc
55115
.mypy_cache/
56116
.ruff_cache/

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Claude Code Proxy
1+
# Claude Code Proxy SSY
22

3-
Claude Code Proxy 是一个命令行工具,可以将Claude API转换为OpenAI兼容的格式,让您在支持OpenAI API的应用程序中使用Claude模型
3+
Claude Code Proxy SSY 是一个命令行工具,可以将Claude API转换为胜算云格式,让您在Claude的应用程序中使用胜算云全球模型API
44

55
## ✨ 功能特性
66

@@ -13,18 +13,45 @@ Claude Code Proxy 是一个命令行工具,可以将Claude API转换为OpenAI
1313

1414
## 📦 安装
1515

16-
### 方式一: 下载预编译二进制文件
16+
### 方式一: 快速安装(推荐)
1717

18-
1.[Releases](https://github.com/your-repo/releases) 页面下载适合您操作系统的二进制文件
18+
**Linux/macOS:**
19+
```bash
20+
sudo curl -o /usr/local/bin/claudeproxy -L https://github.com/SSYCloud/claude-code-proxy-ssy/releases/latest/download/claudeproxy_$(uname -s)_$(uname -m)
21+
sudo chmod +x /usr/local/bin/claudeproxy
22+
```
23+
24+
**Windows (PowerShell):**
25+
```powershell
26+
Invoke-WebRequest -Uri "https://github.com/SSYCloud/claude-code-proxy-ssy/releases/latest/download/claudeproxy_Windows_x86_64.exe" -OutFile "claudeproxy.exe"
27+
```
28+
29+
### 方式二: 使用安装脚本
30+
31+
```bash
32+
curl -fsSL https://raw.githubusercontent.com/SSYCloud/claude-code-proxy-ssy/main/install.sh | bash
33+
```
34+
35+
### 方式三: 手动下载
36+
37+
1.[Releases](https://github.com/SSYCloud/claude-code-proxy-ssy/releases) 页面下载适合您操作系统的二进制文件
1938
2. 解压并将文件放到系统 PATH 中
2039
3. 运行 `claudeproxy setup` 进行初始化
2140

22-
### 方式二: 从源码构建
41+
支持的平台:
42+
- **Linux x86_64**: claudeproxy_Linux_x86_64
43+
- **Linux ARM64**: claudeproxy_Linux_arm64
44+
- **macOS Intel**: claudeproxy_Darwin_x86_64
45+
- **macOS Apple Silicon**: claudeproxy_Darwin_arm64
46+
- **Windows x86_64**: claudeproxy_Windows_x86_64.exe
47+
- **Windows ARM64**: claudeproxy_Windows_arm64.exe
48+
49+
### 方式四: 从源码构建
2350

2451
```bash
2552
# 克隆仓库
26-
git clone https://github.com/your-repo/claude-code-provider-proxy.git
27-
cd claude-code-provider-proxy
53+
git clone https://github.com/SSYCloud/claude-code-proxy-ssy.git
54+
cd claude-code-proxy-ssy
2855

2956
# 构建当前平台
3057
make build

0 commit comments

Comments
 (0)