ai-zero-token 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/README.zh-CN.md +39 -0
- package/admin-ui/dist/assets/index-BBXWfa-w.js +11 -0
- package/admin-ui/dist/assets/index-n7rmcV5d.css +1 -0
- package/admin-ui/dist/assets/wechat-contact-Dlaib1YP.png +0 -0
- package/admin-ui/dist/index.html +13 -0
- package/build/icon.icns +0 -0
- package/build/icon.ico +0 -0
- package/build/icon.png +0 -0
- package/dist/core/providers/http-client.js +1 -1
- package/dist/core/providers/openai-codex/chat.js +23 -0
- package/dist/core/providers/openai-codex/oauth.js +24 -1
- package/dist/core/services/auth-service.js +264 -21
- package/dist/core/services/chat-service.js +2 -2
- package/dist/core/services/config-service.js +15 -3
- package/dist/core/services/image-service.js +2 -2
- package/dist/core/services/version-service.js +18 -13
- package/dist/core/store/settings-store.js +6 -0
- package/dist/desktop/main.js +127 -0
- package/dist/server/admin-page.js +1094 -100
- package/dist/server/app.js +160 -6
- package/docs/DESKTOP_RELEASE.md +64 -0
- package/docs/PRODUCT_UPDATE_DESKTOP_TOOLBOX.md +429 -0
- package/package.json +70 -4
package/README.md
CHANGED
|
@@ -21,9 +21,16 @@ AI Zero Token provides a local CLI, web console, and HTTP gateway that expose sa
|
|
|
21
21
|
- Account JSON import/export, including selected batch export.
|
|
22
22
|
- Apply a saved account to local Codex by backing up and updating `~/.codex/auth.json`.
|
|
23
23
|
- `gpt-image-2` image generation and JSON image editing through the ChatGPT internal Responses path.
|
|
24
|
+
- Optional quota-exhaustion auto switch to the next saved API account with available quota.
|
|
24
25
|
- Optional upstream proxy configuration for OAuth, model refresh, and gateway forwarding.
|
|
25
26
|
- Local model discovery from the Codex model cache with manual refresh support.
|
|
26
27
|
|
|
28
|
+
## Architecture
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
AI Zero Token keeps account tokens and gateway settings in local state, exposes OpenAI-compatible HTTP endpoints, and forwards requests to the selected ChatGPT/Codex OAuth account. The web console reads the same local state, so account switching, Codex auth application, proxy settings, and automatic switching are all controlled from one local place.
|
|
33
|
+
|
|
27
34
|
## Quick Start
|
|
28
35
|
|
|
29
36
|
```bash
|
|
@@ -40,6 +47,35 @@ http://127.0.0.1:8787/v1
|
|
|
40
47
|
|
|
41
48
|
Use any non-empty API key value when a client requires one. Authentication is handled by the local gateway.
|
|
42
49
|
|
|
50
|
+
## Desktop Preview
|
|
51
|
+
|
|
52
|
+
This repository now includes an Electron desktop preview. It starts the existing local gateway from the desktop main process and loads the current web console:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run desktop
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Build desktop release artifacts:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm run dist:mac
|
|
62
|
+
npm run dist:win
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
See [docs/DESKTOP_RELEASE.md](docs/DESKTOP_RELEASE.md) for release notes.
|
|
66
|
+
|
|
67
|
+
The first desktop version keeps the current default listener:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
0.0.0.0:8787
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For local clients, keep using:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
http://127.0.0.1:8787/v1
|
|
77
|
+
```
|
|
78
|
+
|
|
43
79
|
## Web Console
|
|
44
80
|
|
|
45
81
|
The web console is the recommended entry point:
|
|
@@ -50,6 +86,7 @@ The web console is the recommended entry point:
|
|
|
50
86
|
- Export one account or selected accounts.
|
|
51
87
|
- Apply a saved account to local Codex.
|
|
52
88
|
- Configure the default text model and upstream proxy.
|
|
89
|
+
- Enable automatic account switching when the active API account has exhausted its recorded quota.
|
|
53
90
|
- Test `models`, `responses`, `chat.completions`, `images.generations`, and `images.edits`.
|
|
54
91
|
|
|
55
92
|

|
|
@@ -187,6 +224,8 @@ The persistent state directory can be overridden with:
|
|
|
187
224
|
AI_ZERO_TOKEN_HOME=/path/to/home azt start
|
|
188
225
|
```
|
|
189
226
|
|
|
227
|
+
The web console settings are persisted in the same local state directory. The quota auto-switch option is stored as `autoSwitch.enabled`; when enabled, the gateway uses the latest saved quota snapshot and moves API traffic away from the active account once that snapshot shows a quota window is exhausted.
|
|
228
|
+
|
|
190
229
|
The default request body limit is `32 MiB`, which is intended to make JSON base64 image references practical for local image editing. You can override it with:
|
|
191
230
|
|
|
192
231
|
```bash
|
package/README.zh-CN.md
CHANGED
|
@@ -21,9 +21,16 @@ AI Zero Token 是一个本地优先的 OpenAI 兼容网关,用于把 ChatGPT/C
|
|
|
21
21
|
- 支持账号 JSON 导入/导出,以及复选框选择后的批量导出。
|
|
22
22
|
- 支持把已保存账号应用到本机 Codex,并自动备份 `~/.codex/auth.json`。
|
|
23
23
|
- 支持 `gpt-image-2` 文生图和 JSON 图生图。
|
|
24
|
+
- 支持 API 账号额度耗尽后自动切换到下一个仍有额度的账号。
|
|
24
25
|
- 支持上游代理配置,覆盖 OAuth、模型刷新和接口转发。
|
|
25
26
|
- 模型列表优先读取本机 Codex 模型缓存,并支持手动刷新。
|
|
26
27
|
|
|
28
|
+
## 技术架构
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
AI Zero Token 会把账号 token、网关配置和运行状态保存在本地,通过 OpenAI 兼容接口转发到当前选中的 ChatGPT/Codex OAuth 账号。管理页读取同一份本地状态,因此账号切换、应用到 Codex、代理配置和额度耗尽自动切换都可以在本地统一管理。
|
|
33
|
+
|
|
27
34
|
## 快速开始
|
|
28
35
|
|
|
29
36
|
```bash
|
|
@@ -40,6 +47,35 @@ http://127.0.0.1:8787/v1
|
|
|
40
47
|
|
|
41
48
|
如果客户端必须填写 API Key,可以填任意非空占位值;真正起作用的是本地网关里的账号授权。
|
|
42
49
|
|
|
50
|
+
## 桌面端预览
|
|
51
|
+
|
|
52
|
+
当前仓库已提供 Electron 桌面端预览入口。它会在桌面主进程中启动现有本地网关,并直接加载当前管理页:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run desktop
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
构建桌面端发布包:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm run dist:mac
|
|
62
|
+
npm run dist:win
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
发布说明见 [docs/DESKTOP_RELEASE.md](docs/DESKTOP_RELEASE.md)。
|
|
66
|
+
|
|
67
|
+
桌面端第一版沿用现有默认监听策略:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
0.0.0.0:8787
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
本机客户端仍建议使用:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
http://127.0.0.1:8787/v1
|
|
77
|
+
```
|
|
78
|
+
|
|
43
79
|
## 管理页
|
|
44
80
|
|
|
45
81
|
管理页是推荐入口,可以完成:
|
|
@@ -50,6 +86,7 @@ http://127.0.0.1:8787/v1
|
|
|
50
86
|
- 导出单个账号或勾选导出多个账号。
|
|
51
87
|
- 将已保存账号应用到本机 Codex。
|
|
52
88
|
- 配置默认文本模型和上游代理。
|
|
89
|
+
- 开启当前 API 账号额度耗尽后的自动切换。
|
|
53
90
|
- 测试 `models`、`responses`、`chat.completions`、`images.generations`、`images.edits`。
|
|
54
91
|
|
|
55
92
|

|
|
@@ -187,6 +224,8 @@ AZT_CORS_ORIGIN=http://127.0.0.1:8124,http://localhost:3000 azt start
|
|
|
187
224
|
AI_ZERO_TOKEN_HOME=/path/to/home azt start
|
|
188
225
|
```
|
|
189
226
|
|
|
227
|
+
管理页里的配置会保存在同一个本地状态目录。额度耗尽自动切换会保存为 `autoSwitch.enabled`;开启后,网关会根据最近一次保存的额度快照判断当前 API 账号是否耗尽,并把 API 流量切到下一个仍有额度的账号。
|
|
228
|
+
|
|
190
229
|
默认请求体上限是 `32 MiB`,用于让 JSON base64 图片在本地图片编辑场景里更实用。可以用下面的环境变量覆盖:
|
|
191
230
|
|
|
192
231
|
```bash
|