diff --git a/README.en.md b/README.en.md index ee71977..6b51285 100644 --- a/README.en.md +++ b/README.en.md @@ -65,13 +65,13 @@ It's more than an API proxy: it ships with **credit billing, CDK top-ups, referr #### 🎨 Generation - Images + videos in one place, with **image-to-image / reference frames** (first frame, last frame, style reference) -- Multiple resolutions (1K / 2K / 4K), aspect ratios and video durations — configured and priced per model +- Multiple resolutions (images 1K / 2K / 4K · videos 720p / 1080p), aspect ratios and video durations — configured and priced per model - 7 providers, 10+ models, **enable / disable / re-price from the admin console**, no code changes #### 🔌 OpenAI Compatible - Text-to-image `/v1/images/generations` · image-to-image `/v1/images/edits` (multipart ref upload) · video `/v1/videos` (Sora-style async: create → poll → `/content`) · `/v1/models` -- **Strict OpenAI params**: `size` sets the aspect ratio, `quality` the resolution tier — just swap `base_url` + `api_key` into an existing OpenAI SDK -- Image results returned **inline as base64** — nothing stored server-side, privacy-friendly +- **Strict OpenAI params**: `size` drives **both aspect ratio + resolution tier** (images by long edge → 1K/2K/4K, videos by short edge → 720p/1080p) — just swap `base_url` + `api_key` into an existing OpenAI SDK +- Image results returned **inline as base64** — nothing stored server-side, privacy-friendly; the in-app **/docs** ships a size ↔ tier reference table #### 🔁 Account Pools + Smart Failover - Round-robin scheduling across the pool; one bad account doesn't break the whole @@ -86,16 +86,19 @@ It's more than an API proxy: it ships with **credit billing, CDK top-ups, referr #### 💳 Billing & Operations - Credit-based (**pre-deduct + refund on failure**), priced per model / resolution / duration - **Agent pricing**: a user can be set as an "agent" role and models can carry agent prices; agent users (including their API key calls) are billed at the agent price, falling back to the normal price when unset +- **Online top-up (易支付 / epay)**: WeChat / Alipay QR, preset + custom amounts, unpaid orders auto-cancel after 30 min, MD5-verified idempotent callback auto-credits; cumulative top-up tracked - **CDK redeem codes** · **referral rewards** · email sign-up / verification code / password reset +- **Concurrency groups**: cap a user's simultaneous generations (playground + API key combined, `0` = unlimited), self-healing Redis counters, new users auto-join the default group - Three roles: regular user / agent / admin (single) #### 🖥️ User Frontend (Vue 3) - Playground · creations gallery · generation logs (with failure reasons / source tags) -- API docs · API key management · referral · about, light / dark theme +- **Top-up · Orders** (recharge history / resume unpaid) · API docs · API key management · referral · about, light / dark theme +- **In-app announcements**: a Markdown notice pops up after login and re-shows whenever its content changes #### 🛠️ Admin Console - Overview dashboard (trends / DAU / top failures / top spenders) -- Model management (normal + agent price) · account management (bulk import / dedup / quota) · site-wide logs · user management (set as agent) · CDK · showcase · site config +- Model management (normal + agent price) · account management (bulk import / dedup / quota) · **concurrency groups** · **order management** (filter / search / paginate) · site-wide logs · user management (set as agent / assign concurrency group / view cumulative top-up) · CDK · showcase · **announcements** · site config (incl. epay) **🧰 Engineering highlights**: tls-client (Chrome JA3/JA4 fingerprint) reliably passes Cloudflare · media stored in S3/RustFS, served through an authenticated proxy with retention cleanup · self-healing maintenance loop (quota recovery / credential refresh / orphan-job cleanup with refunds) · one-command Docker deploy with acme.sh auto HTTPS. @@ -116,15 +119,14 @@ It's more than an API proxy: it ships with **credit billing, CDK top-ups, referr ## 🔌 OpenAI-Compatible API ```bash -# Text-to-image — pure OpenAI params: size→aspect ratio, quality→tier (low/medium/high→1K/2K/4K) +# Text-to-image — pure OpenAI params: size drives both aspect ratio + tier (long edge <1800→1K / <3500→2K / ≥3500→4K) curl https://your-domain/v1/images/generations \ -H "Authorization: Bearer sk-xxxx" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a cute cat on a desk, studio lighting", - "size": "1024x1024", - "quality": "high" + "size": "2048x2048" }' # Image-to-image — multipart reference upload (multiple via image[]) @@ -238,8 +240,10 @@ backend/ Backend source (Go) │ │ ├── grok/ Grok (grok.com, spoofed statsig, video) │ │ ├── leonardo/ Leonardo │ │ ├── krea/ Krea -│ │ └── imagine/ Imagine.art -│ ├── repo/ Data-access layer (users / models / accounts / logs / CDK…) +│ │ ├── imagine/ Imagine.art +│ │ ├── custom/ Custom upstream (OpenAI-compatible v1, routed by id) +│ │ └── epay/ 易支付 / epay (mapi order + MD5-verified callback, top-ups) +│ ├── repo/ Data-access layer (users / models / accounts / logs / CDK / orders / concurrency groups…) │ ├── service/ Business logic (scheduling, billing, account pools, keep-alive, maintenance) │ └── storage/ RustFS / S3 media storage ├── Dockerfile Multi-stage build (compile source → slim runtime image) @@ -247,7 +251,7 @@ backend/ Backend source (Go) frontend/ Frontend source (Vue 3 + Vite) ├── src/ -│ ├── views/ Pages (playground / accounts / models / logs / overview / users…) +│ ├── views/ Pages (playground / accounts / models / users / concurrency / orders / logs / overview / top-up / settings…) │ ├── components/ Reusable components (modals / selectors / lightbox…) │ ├── layouts/ Public / admin layouts │ ├── utils/ Utility functions diff --git a/README.md b/README.md index 88420b4..ba99219 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ > 💡 前后端**完全开源**(MIT),Go + Vue 3,可自由二开 / 自部署。 -**一句话亮点** 🔌 OpenAI 兼容 · 🤖 7 平台十余模型 · 🔁 自动换号 / Token 保活 · 💳 积分 + 代理价计费 · 🎨 画图前端 + 管理后台 · 🐳 一键部署 + 自动 HTTPS +**一句话亮点** 🔌 OpenAI 兼容 · 🤖 7 平台十余模型 · 🔁 自动换号 / Token 保活 · 💳 积分 + 在线充值(易支付)+ 代理价 · 🧩 并发分组 · 🎨 画图前端 + 管理后台 · 🐳 一键部署 + 自动 HTTPS ## 🖼️ 界面预览 @@ -65,13 +65,13 @@ #### 🎨 生成能力 - 生图 + 生视频一站式,支持**图生图 / 参考图**(首帧、末帧、风格参考) -- 多分辨率(1K / 2K / 4K)、多宽高比、视频多时长,按模型独立配置与定价 +- 多分辨率(图像 1K / 2K / 4K · 视频 720p / 1080p)、多宽高比、视频多时长,按模型独立配置与定价 - 7 大供应商、十余模型,后台**动态启用 / 下架 / 改价**,无需改代码 #### 🔌 OpenAI 兼容 - 文生图 `/v1/images/generations` · 图生图 `/v1/images/edits`(multipart 上传参考图) · 视频 `/v1/videos`(Sora 式异步:创建→轮询→`/content` 下载) · `/v1/models` -- **严格 OpenAI 入参**:`size` 决定比例、`quality` 决定画质档,改个 `base_url` + `api_key` 即接现有 OpenAI SDK -- 图片结果 **base64 直返**,服务端不留存文件,隐私友好 +- **严格 OpenAI 入参**:`size` **同时决定比例 + 分辨率档**(图像看长边 → 1K/2K/4K,视频看短边 → 720p/1080p),改个 `base_url` + `api_key` 即接现有 OpenAI SDK +- 图片结果 **base64 直返**,服务端不留存文件,隐私友好;站内 **/docs** 附「分辨率对照表」直接查 `size` 该传什么 #### 🔁 多账号池 + 智能故障转移 - 账号池调度,单账号出错不影响整体 @@ -93,16 +93,19 @@ #### 💳 计费与运营 - 积分制(**预扣 + 失败退款**),按模型 / 分辨率 / 时长精细定价 - **代理价体系**:用户可设为「代理」角色,模型可设代理价;代理用户(含其 API Key 调用)自动按代理价计费,未设代理价则回退普通价 +- **在线充值(易支付)**:微信 / 支付宝扫码,金额档位 + 自定义,订单 30 分钟未付自动取消,支付回调 MD5 验签 + 幂等自动到账;累计充值可查 - **CDK 兑换码**充值 · **邀请奖励** · 邮箱注册 / 验证码 / 找回密码 +- **并发分组**:按分组限制用户「同时生成数」(画图台 + API Key 合计,`0` = 不限),Redis 自愈计数,新用户自动入默认组 - 三级角色:普通用户 / 代理 / 管理员(唯一) #### 🖥️ 用户前台(Vue 3) - 画图台 · 创作记录画廊 · 生成日志(含失败原因 / 来源标签) -- API 文档 · API Key 管理 · 邀请 · 关于,亮 / 暗主题 +- **充值 · 订单**(充值记录 / 未付可继续支付) · API 文档 · API Key 管理 · 邀请 · 关于,亮 / 暗主题 +- **站内公告**:登录后自动弹出 Markdown 公告,内容更新即重推 #### 🛠️ 管理后台 - 概览看板(趋势 / DAU / 失败 Top / 消费榜) -- 模型管理(普通价 + 代理价) · 账号管理(批量导入 / 去重 / 额度) · 全站日志 · 用户管理(设为代理) · CDK · 展示位 · 站点配置 +- 模型管理(普通价 + 代理价) · 账号管理(批量导入 / 去重 / 额度) · **并发分组** · **订单管理**(筛选 / 搜索 / 分页) · 全站日志 · 用户管理(设为代理 / 分配并发组 / 看累计充值) · CDK · 展示位 · **站点公告** · 站点配置(含易支付) **🧰 工程亮点**:tls-client(Chrome JA3/JA4 指纹)稳定穿透 Cloudflare · 媒体存 S3/RustFS 经鉴权代理分发 + 保留期清理 · 自愈式维护轮询(恢复额度 / 刷新凭据 / 清理僵死任务并退款) · 一条命令 Docker 部署 + acme.sh 自动 HTTPS。 @@ -124,15 +127,14 @@ ## 🔌 OpenAI 兼容 API ```bash -# 文生图 —— 纯 OpenAI 参数:size→比例,quality→画质档(low/medium/high→1K/2K/4K) +# 文生图 —— 纯 OpenAI 参数:size 同时决定比例 + 分辨率档(长边 <1800→1K / <3500→2K / ≥3500→4K) curl https://你的域名/v1/images/generations \ -H "Authorization: Bearer sk-xxxx" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a cute cat on a desk, studio lighting", - "size": "1024x1024", - "quality": "high" + "size": "2048x2048" }' # 图生图 —— multipart 上传参考图(可多张 image[]) @@ -247,8 +249,9 @@ backend/ 后端源码(Go) │ │ ├── leonardo/ Leonardo │ │ ├── krea/ Krea │ │ ├── imagine/ Imagine.art -│ │ └── custom/ 自定义上游(OpenAI 兼容 v1,按 id 路由,直连不走代理) -│ ├── repo/ 数据访问层(用户 / 模型 / 账号 / 日志 / CDK…) +│ │ ├── custom/ 自定义上游(OpenAI 兼容 v1,按 id 路由,直连不走代理) +│ │ └── epay/ 易支付(mapi 下单 + 回调 MD5 验签,积分充值) +│ ├── repo/ 数据访问层(用户 / 模型 / 账号 / 日志 / CDK / 订单 / 并发组…) │ ├── service/ 业务逻辑(生成调度、计费、账号池、保活、维护) │ └── storage/ RustFS / S3 媒体存储 ├── Dockerfile 多阶段构建(源码编译 → 精简运行镜像) @@ -256,7 +259,7 @@ backend/ 后端源码(Go) frontend/ 前端源码(Vue 3 + Vite) ├── src/ -│ ├── views/ 页面(画图台 / 账号 / 模型 / 日志 / 概览 / 用户…) +│ ├── views/ 页面(画图台 / 账号 / 模型 / 用户 / 并发组 / 订单 / 日志 / 概览 / 充值 / 设置…) │ ├── components/ 复用组件(弹窗 / 选择器 / 灯箱…) │ ├── layouts/ 公共 / 后台布局 │ ├── utils/ 工具函数