asemxin commited on
Commit
784ab0d
·
0 Parent(s):

Initial commit: monica-proxy for HF Spaces

Browse files
Files changed (2) hide show
  1. Dockerfile +30 -0
  2. README.md +39 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build from source
2
+ FROM golang:1.23-alpine AS builder
3
+
4
+ RUN apk add --no-cache git ca-certificates
5
+
6
+ WORKDIR /app
7
+
8
+ # Clone the repository
9
+ RUN git clone https://github.com/ycvk/monica-proxy.git .
10
+
11
+ # Download dependencies and build
12
+ RUN go mod download
13
+ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o monica-proxy main.go
14
+
15
+ # Stage 2: Runtime
16
+ FROM alpine:latest
17
+
18
+ RUN apk --no-cache add ca-certificates tzdata
19
+
20
+ WORKDIR /app
21
+
22
+ COPY --from=builder /app/monica-proxy .
23
+
24
+ # HF Spaces uses port 7860
25
+ ENV SERVER_PORT=7860
26
+ ENV SERVER_HOST=0.0.0.0
27
+
28
+ EXPOSE 7860
29
+
30
+ CMD ["./monica-proxy"]
README.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Monica Proxy
3
+ emoji: 🤖
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ ---
10
+
11
+ # Monica Proxy
12
+
13
+ 将 Monica AI 转换为 ChatGPT 兼容的 OpenAI API。
14
+
15
+ ## 配置
16
+
17
+ 在 HF Spaces 的 Settings > Secrets 中添加:
18
+
19
+ | Secret | 描述 |
20
+ |--------|------|
21
+ | `MONICA_COOKIE` | Monica 登录 Cookie |
22
+ | `BEARER_TOKEN` | API 访问令牌 |
23
+
24
+ ## API 端点
25
+
26
+ - `GET /v1/models` - 获取模型列表
27
+ - `POST /v1/chat/completions` - 聊天对话
28
+ - `POST /v1/images/generations` - 图片生成
29
+
30
+ ## 使用示例
31
+
32
+ ```bash
33
+ curl -H "Authorization: Bearer YOUR_TOKEN" \
34
+ https://YOUR-SPACE.hf.space/v1/models
35
+ ```
36
+
37
+ ## 来源
38
+
39
+ [ycvk/monica-proxy](https://github.com/ycvk/monica-proxy)