[UNTESTED] [JiangshuoZhao/joycode-proxy] 2 endpoint(s)
ChatGPT
API Proxy/ChatGPT
2,168 characters
Status: [UNTESTED]
Endpoints found:
http://localhost:8765/v1/chat/completions
http://localhost:8765/v1/models
Source: https://github.com/JiangshuoZhao/joycode-proxy
# JoyCode OpenAI Proxy
通过京东 Color Gateway (api-ai.jd.com) 将 JoyCode API 代理为 OpenAI Chat Completions 兼容格式,可直接对接任何支持 OpenAI API 的客户端。
## 功能特性
- **OpenAI 兼容** — `/v1/chat/completions`、`/v1/models` 等标准端点
- **流式 & 非流式** — 完整支持 SSE 流式输出和普通响应
- **多模型支持** — JoyAI-Code-1.5、GLM-5.3、Kimi-K2.6、MiniMax-M3、Doubao-Seed-2.0-pro 等
- **HMAC 签名** — 自动构建 Color Gateway 请求签名
- **Token 自动提取** — 从 JoyCode IDE 用户数据中提取 pt_key
- **API Key 保护** — 可选的代理接口鉴权
- **CORS 支持** — 开箱即用的跨域配置
## 快速开始
### 1. 安装依赖
```bash
pip install -r requirements.txt
```
### 2. 配置认证
复制配置模板并填入认证信息:
```bash
cp config.yaml.example config.yaml
```
编辑 `config.yaml`,填入以下关键字段:
| 字段 | 说明 |
|------|------|
| `joycode.color_gateway.tenant` | 租户 ID |
| `joycode.color_gateway.user_id` | 用户 ID |
| `joycode.pt_key` | 认证 Token |
#### 自动提取 Token(推荐)
如果已安装 JoyCode IDE 并登录过,可直接运行提取脚本:
```bash
bash extract-token.sh
```
脚本会自动从 IDE 用户数据中提取 pt_key 并写入 `config.yaml`。
### 3. 启动服务
```bash
# 直接启动
python3 main.py
# 使用启动脚本
bash start.sh
# 自定义参数
python3 main.py -c config.yaml -H 0.0.0.0 -p 8765 --log-level DEBUG
```
服务默认监听 `0.0.0.0:8765`。
## API 端点
| 端点 | 方法 | 说明 |
|------|------|------|
| `/v1/chat/completions` | POST | Chat Completions(兼容 OpenAI) |
| `/v1/models` | GET | 列出可用模型 |
| `/v1/models/{model_id}` | GET | 获取模型详情 |
| `/auth/login` | POST | 登录认证 |
| `/auth/status` | GET | 认证状态 |
| `/health` | GET | 健康检查 |
## 使用示例
### Chat Completions
```bash
curl http://localhost:8765/v1/c