gdtiti commited on
Commit
12a11a5
·
1 Parent(s): ffc5022

我的镜像

Browse files
Files changed (8) hide show
  1. .dockerignore +54 -0
  2. Dockerfile +39 -0
  3. README.md +79 -4
  4. auths/.gitkeep +0 -0
  5. config.yaml +63 -0
  6. logs/.gitkeep +0 -0
  7. start.sh +9 -0
  8. static/management.html +0 -0
.dockerignore ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+
5
+ # Documentation
6
+ *.md
7
+ docs/
8
+
9
+ # IDE
10
+ .vscode
11
+ .idea
12
+
13
+ # OS
14
+ .DS_Store
15
+ Thumbs.db
16
+
17
+ # Python
18
+ __pycache__
19
+ *.pyc
20
+ *.pyo
21
+ *.pyd
22
+ .Python
23
+ env
24
+ pip-log.txt
25
+ pip-delete-this-directory.txt
26
+ .tox
27
+ .coverage
28
+ .coverage.*
29
+ .cache
30
+ nosetests.xml
31
+ coverage.xml
32
+ *.cover
33
+ *.log
34
+ .git
35
+ .mypy_cache
36
+ .pytest_cache
37
+ .hypothesis
38
+
39
+ # Virtual environments
40
+ venv/
41
+ env/
42
+ ENV/
43
+ env.bak/
44
+ venv.bak/
45
+
46
+ # Jupyter Notebook
47
+ .ipynb_checkpoints
48
+
49
+ # pyenv
50
+ .python-version
51
+
52
+ # Environments
53
+ .env
54
+ .venvvenv
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用官方镜像作为基础镜像
2
+ FROM ghcr.io/gdtiti/cliproxy-api:v1.1
3
+
4
+ WORKDIR /CLIProxyAPI
5
+
6
+ COPY config.yaml /CLIProxyAPI/config.yaml
7
+
8
+ COPY auths /CLIProxyAPI/auths
9
+
10
+ COPY logs /CLIProxyAPI/logs
11
+
12
+ COPY static /CLIProxyAPI/static
13
+
14
+ RUN chmod 777 /CLIProxyAPI/logs
15
+
16
+ RUN chmod 777 /CLIProxyAPI/auths
17
+
18
+ RUN chmod 777 /CLIProxyAPI/config.yaml
19
+
20
+ # Gemini CLI 镜像环境变量
21
+ ENV GEMINI_CODE_ASSIST_ENDPOINT=""
22
+ ENV GEMINI_OAUTH_ENDPOINT=""
23
+ ENV GEMINI_GOOGLE_APIS_ENDPOINT=""
24
+ ENV GEMINI_RESOURCE_MANAGER_ENDPOINT=""
25
+ ENV GEMINI_SERVICE_USAGE_ENDPOINT=""
26
+
27
+ # 远程管理环境变量
28
+ ENV REMOTE_MANAGEMENT_ALLOW_REMOTE=""
29
+ ENV REMOTE_MANAGEMENT_SECRET_KEY=""
30
+
31
+ # 暴露端口
32
+ EXPOSE 8317
33
+
34
+ # 设置环境变量
35
+ ENV PORT=8317
36
+ ENV HOST=0.0.0.0
37
+
38
+ # 启动命令
39
+ CMD ["./CLIProxyAPI"]
README.md CHANGED
@@ -1,10 +1,85 @@
1
  ---
2
- title: Xxxvvvzzz
3
- emoji: 📈
4
- colorFrom: red
5
  colorTo: yellow
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: CLIProxyAPI
3
+ emoji: 😻
4
+ colorFrom: purple
5
  colorTo: yellow
6
  sdk: docker
7
  pinned: false
8
+ app_port: 8317
9
  ---
10
 
11
+ # CLIProxyAPI
12
+
13
+ CLIProxyAPI 是一个基于 Hugging Face Spaces 部署的 API 代理服务,用于提供 CLI 工具的 Web API 接口。
14
+
15
+ ## 功能特性
16
+
17
+ - 提供 CLI 工具的 HTTP API 接口
18
+ - 支持多种命令行工具的远程调用
19
+ - 基于 Docker 容器化部署
20
+ - 适用于 Hugging Face Spaces 环境
21
+ - 支持通过环境变量自定义配置
22
+
23
+ ## 部署信息
24
+
25
+ 本部署使用以下 Docker 镜像:
26
+ - 镜像名称:`ghcr.io/gdtiti/cliproxy-api:1.1`
27
+ - 基础环境:Python
28
+ - 端口:8317 (CLIProxyAPI 默认端口)
29
+
30
+ ## 环境变量配置
31
+
32
+ ### Gemini CLI 配置
33
+
34
+ 您可以通过以下环境变量自定义 Gemini CLI 的镜像节点配置:
35
+
36
+ - `GEMINI_CODE_ASSIST_ENDPOINT`: Code Assist API 端点(必配)
37
+ - `GEMINI_OAUTH_ENDPOINT`: OAuth2 认证端点(必配)
38
+ - `GEMINI_GOOGLE_APIS_ENDPOINT`: Google APIs 基础端点(必配)
39
+ - `GEMINI_RESOURCE_MANAGER_ENDPOINT`: Resource Manager API 端点(可选)
40
+ - `GEMINI_SERVICE_USAGE_ENDPOINT`: Service Usage API 端点(可选)
41
+
42
+ ### 远程管理配置
43
+
44
+ 您可以通过以下环境变量自定义远程管理设置:
45
+
46
+ - `REMOTE_MANAGEMENT_ALLOW_REMOTE`: 是否允许远程管理访问(true/false)
47
+ - `REMOTE_MANAGEMENT_SECRET_KEY`: 管理密钥(如果设置,将覆盖配置文件中的默认值)
48
+
49
+ ## 使用方法
50
+
51
+ 部署完成后,您可以通过以下方式访问 API:
52
+
53
+ 1. 直接访问 Space 页面查看 API 文档
54
+ 2. 发送 HTTP 请求到 API 端点
55
+
56
+ ### API 端点示例
57
+
58
+ ```bash
59
+ # 基本健康检查
60
+ curl https://your-space.hf.space/health
61
+
62
+ # 执行命令
63
+ curl -X POST https://your-space.hf.space/api/execute \
64
+ -H "Content-Type: application/json" \
65
+ -d '{"command": "ls -la"}'
66
+ ```
67
+
68
+ ## 配置说明
69
+
70
+ 本部署使用以下环境变量:
71
+
72
+ - `PORT=8317`: 服务端口
73
+ - `HOST=0.0.0.0`: 监听地址
74
+
75
+ ## 开发与部署
76
+
77
+ 如需在本地开发或自定义部署,请参考原始项目 [CLIProxyAPI](https://github.com/gdtiti/CLIProxyAPI)。
78
+
79
+ ## 许可证
80
+
81
+ 请参考原始项目的许可证条款。
82
+
83
+ ---
84
+
85
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
auths/.gitkeep ADDED
File without changes
config.yaml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Server port
2
+
3
+ port: 8317
4
+ # Management API settings
5
+ remote-management:
6
+ # Whether to allow remote (non-localhost) management access.
7
+
8
+ # When false, only localhost can access management endpoints (a key is still required).
9
+ allow-remote: true
10
+ # Management key. If a plaintext value is provided here, it will be hashed on startup.
11
+
12
+ # All management requests (even from localhost) require this key.
13
+
14
+ # Leave empty to disable the Management API entirely (404 for all /v0/management routes).
15
+ secret-key: "$2a$10$bySJShk7ToI54X/8jPTn6uoY58n1qwGud9pyMh1qQTJe7naK21RsC"
16
+ # Disable the bundled management control panel asset download and HTTP route when true.
17
+ disable-control-panel: false
18
+ # Authentication directory (supports ~ for home directory)
19
+ auth-dir: "/CLIProxyAPI/auths"
20
+ # API keys for authentication
21
+ api-keys: []
22
+
23
+ # Enable debug logging
24
+ debug: true
25
+ # When true, write application logs to rotating files instead of stdout
26
+ logging-to-file: false
27
+ # When false, disable in-memory usage statistics aggregation
28
+ usage-statistics-enabled: true
29
+ # Proxy URL. Supports socks5/http/https protocols. Example: socks5://user:pass@192.168.1.1:1080/
30
+ proxy-url: ""
31
+ # Number of times to retry a request. Retries will occur if the HTTP response code is 403, 408, 500, 502, 503, or 504.
32
+ request-retry: 3
33
+ # Quota exceeded behavior
34
+ quota-exceeded:
35
+ switch-project: true # Whether to automatically switch to another project when a quota is exceeded
36
+ switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded
37
+ # API keys for official Generative Language API
38
+
39
+ # Gemini CLI 镜像节点配置
40
+ gemini-cli:
41
+ # Code Assist API 端点(必配)
42
+ code-assist-endpoint: ""
43
+ # OAuth2 认证端点(必配)
44
+ oauth-endpoint: ""
45
+ # Google APIs 基础端点(必配)
46
+ google-apis-endpoint: ""
47
+ # Resource Manager API 端点(可选)
48
+ resource-manager-endpoint: ""
49
+ # Service Usage API 端点(可选)
50
+ service-usage-endpoint: ""
51
+
52
+ request-log: true
53
+ generative-language-api-key: []
54
+ claude-api-key: []
55
+ codex-api-key: []
56
+ openai-compatibility: []
57
+ gemini-web:
58
+ context: true
59
+ code-mode: false
60
+ max-chars-per-request: 0
61
+
62
+ # Gemini CLI 专用代理(可选,覆盖全局设置)
63
+ # proxy-url: "socks5://127.0.0.1:10808"
logs/.gitkeep ADDED
File without changes
start.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # 设置环境变量
4
+ export PORT=8317
5
+ export HOST=0.0.0.0
6
+
7
+ # 启动应用
8
+ echo "Starting CLIProxyAPI on port $PORT..."
9
+ python app.py
static/management.html ADDED
The diff for this file is too large to render. See raw diff