ai-zero-token 1.0.6 → 1.0.8
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/CHANGELOG.md +16 -0
- package/README.md +141 -356
- package/README.zh-CN.md +248 -0
- package/dist/cli/commands/serve.js +1 -0
- package/dist/core/providers/openai-codex/oauth.js +6 -3
- package/dist/core/services/auth-service.js +27 -0
- package/dist/core/services/image-service.js +12 -9
- package/dist/core/store/codex-auth-store.js +94 -0
- package/dist/core/store/profile-transfer.js +4 -0
- package/dist/server/admin-page.js +79 -15
- package/dist/server/app.js +207 -3
- package/dist/server/index.js +17 -2
- package/docs/API_USAGE.md +19 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.8 - 2026-04-29
|
|
4
|
+
|
|
5
|
+
- Removed local Free-plan blocking for image generation and editing; upstream account limits now decide availability.
|
|
6
|
+
- Switched image request orchestration to `gpt-5.4-mini` while keeping the requested image model on the `image_generation` tool.
|
|
7
|
+
- Increased the default gateway request body limit to 32 MiB and added `AZT_BODY_LIMIT_MB` for large JSON base64 image inputs.
|
|
8
|
+
- Updated the management-page update command to `npm install -g ai-zero-token`.
|
|
9
|
+
- Reworked the README into a cleaner open-source project format and added `README.zh-CN.md` for Simplified Chinese.
|
|
10
|
+
|
|
11
|
+
## 1.0.7 - 2026-04-29
|
|
12
|
+
|
|
13
|
+
- Added JSON `POST /v1/images/edits` support for image-to-image workflows with URL, base64 data URL, or raw base64 image references.
|
|
14
|
+
- Added management-page Edits test examples and documented the JSON image editing request format.
|
|
15
|
+
- Added `id_token` persistence for login, refresh, import, export, and account transfer JSON.
|
|
16
|
+
- Added "Apply to Codex" account action to back up and update local `~/.codex/auth.json` for new Codex sessions.
|
|
17
|
+
- Updated the local AI-Zero-Token skill documentation package with image editing and Codex account switching guidance.
|
|
18
|
+
|
|
3
19
|
## 1.0.6 - 2026-04-28
|
|
4
20
|
|
|
5
21
|
- Added account JSON import/export support in the management page.
|
package/README.md
CHANGED
|
@@ -1,463 +1,248 @@
|
|
|
1
1
|
# AI Zero Token
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Local-first OpenAI-compatible gateway for ChatGPT/Codex OAuth accounts.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
AI Zero Token provides a local CLI, web console, and HTTP gateway that expose saved ChatGPT/Codex account capabilities through OpenAI-style endpoints. It is designed for local single-user workflows, prototyping, automation, and OpenAI-compatible clients.
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- `POST /v1/responses`
|
|
11
|
-
- `POST /v1/chat/completions`
|
|
12
|
-
- `GET /v1/models`
|
|
9
|
+
> This is an experimental local tool. It is not an official OpenAI product and is not recommended as a production multi-tenant gateway.
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
## Features
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
- OpenAI-compatible local API:
|
|
14
|
+
- `GET /v1/models`
|
|
15
|
+
- `POST /v1/responses`
|
|
16
|
+
- `POST /v1/chat/completions`
|
|
17
|
+
- `POST /v1/images/generations`
|
|
18
|
+
- `POST /v1/images/edits`
|
|
19
|
+
- ChatGPT/Codex OAuth login with local token refresh.
|
|
20
|
+
- Multi-account management in the web console.
|
|
21
|
+
- Account JSON import/export, including selected batch export.
|
|
22
|
+
- Apply a saved account to local Codex by backing up and updating `~/.codex/auth.json`.
|
|
23
|
+
- `gpt-image-2` image generation and JSON image editing through the ChatGPT internal Responses path.
|
|
24
|
+
- Optional upstream proxy configuration for OAuth, model refresh, and gateway forwarding.
|
|
25
|
+
- Local model discovery from the Codex model cache with manual refresh support.
|
|
28
26
|
|
|
29
|
-
##
|
|
27
|
+
## Quick Start
|
|
30
28
|
|
|
31
29
|
```bash
|
|
32
30
|
npm install -g ai-zero-token
|
|
33
31
|
azt start
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
The command starts the local web console and gateway:
|
|
37
35
|
|
|
38
36
|
```text
|
|
37
|
+
http://127.0.0.1:8787
|
|
39
38
|
http://127.0.0.1:8787/v1
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-

|
|
45
|
-
|
|
46
|
-
## 生图结果预览
|
|
47
|
-
|
|
48
|
-
下图通过 AI Zero Token 本地网关调用 `POST /v1/images/generations` 生成,模型为 `gpt-image-2`。
|
|
49
|
-
|
|
50
|
-

|
|
51
|
-
|
|
52
|
-
## 为什么做这个项目
|
|
53
|
-
|
|
54
|
-
如果你只是想在自己的电脑上更低门槛地接入主流 LLM,现实里通常会遇到这几个问题:
|
|
55
|
-
|
|
56
|
-
- 已经有产品订阅,但还没有开发者 API 方案
|
|
57
|
-
- 想把能力接入自己的脚本、前端、本地工作流,但不想每次都手工操作网页
|
|
58
|
-
- 想统一本地调用方式,而不是每家产品各写一套接入逻辑
|
|
59
|
-
- 想学习 OAuth、CLI、网关、npm CLI、桌面端这类真实工程能力
|
|
60
|
-
|
|
61
|
-
AI Zero Token 就是围绕这些问题设计的。
|
|
62
|
-
|
|
63
|
-
## 它能解决什么
|
|
64
|
-
|
|
65
|
-
- 想把 ChatGPT 的图片生成能力接到自己的前端、小工具或脚本里
|
|
66
|
-
- 想先用本地网关验证产品原型,而不是一上来就重做整套后端
|
|
67
|
-
- 想统一成 OpenAI 风格接口,减少接入成本
|
|
68
|
-
- 想研究一条完整的 OAuth -> token -> 本地状态 -> 网关 -> 上游请求链路
|
|
69
|
-
|
|
70
|
-
## 架构概览
|
|
41
|
+
Use any non-empty API key value when a client requires one. Authentication is handled by the local gateway.
|
|
71
42
|
|
|
72
|
-
|
|
43
|
+
## Web Console
|
|
73
44
|
|
|
74
|
-
|
|
45
|
+
The web console is the recommended entry point:
|
|
75
46
|
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
- 模型列表优先读取本机 Codex 最新缓存,并支持在 CLI / 管理页手动同步
|
|
84
|
-
- 暴露 OpenAI 风格接口:
|
|
85
|
-
- `GET /v1/models`
|
|
86
|
-
- `POST /v1/responses`
|
|
87
|
-
- `POST /v1/chat/completions`
|
|
88
|
-
- `POST /v1/images/generations`
|
|
89
|
-
|
|
90
|
-
## 适合谁用
|
|
47
|
+
- Log in with OpenAI Codex OAuth.
|
|
48
|
+
- Import one or more account JSON files.
|
|
49
|
+
- Switch the active account.
|
|
50
|
+
- Export one account or selected accounts.
|
|
51
|
+
- Apply a saved account to local Codex.
|
|
52
|
+
- Configure the default text model and upstream proxy.
|
|
53
|
+
- Test `models`, `responses`, `chat.completions`, `images.generations`, and `images.edits`.
|
|
91
54
|
|
|
92
|
-
-
|
|
93
|
-
- 想把 `gpt-image-2` 生图接口直接接给脚本、前端或自动化流程的人
|
|
94
|
-
- 想做自己的 AI 网关、AI CLI、AI 桌面端的人
|
|
95
|
-
- 想学习一条完整 OAuth -> token -> CLI -> HTTP API 链路的人
|
|
96
|
-
- 想把 AI 能力接入脚本、前端或自动化流程的人
|
|
55
|
+

|
|
97
56
|
|
|
57
|
+
## API Usage
|
|
98
58
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- Node.js 22+ 推荐
|
|
102
|
-
- Bun 可用于开发和直接运行源码
|
|
103
|
-
- 终端网络需要可访问:
|
|
104
|
-
- `https://auth.openai.com`
|
|
105
|
-
- `https://chatgpt.com`
|
|
106
|
-
|
|
107
|
-
## 安装与运行
|
|
108
|
-
|
|
109
|
-
### 从源码运行
|
|
110
|
-
|
|
111
|
-
克隆仓库并安装依赖:
|
|
59
|
+
### Models
|
|
112
60
|
|
|
113
61
|
```bash
|
|
114
|
-
|
|
115
|
-
cd AI-Zero-Token
|
|
116
|
-
npm install
|
|
62
|
+
curl http://127.0.0.1:8787/v1/models
|
|
117
63
|
```
|
|
118
64
|
|
|
119
|
-
|
|
65
|
+
### Responses
|
|
120
66
|
|
|
121
67
|
```bash
|
|
122
|
-
|
|
68
|
+
curl http://127.0.0.1:8787/v1/responses \
|
|
69
|
+
-H "content-type: application/json" \
|
|
70
|
+
-d '{"model":"gpt-5.4","input":"Reply with OK only."}'
|
|
123
71
|
```
|
|
124
72
|
|
|
125
|
-
###
|
|
126
|
-
|
|
127
|
-
如果你只是想把它当作本地 CLI 和本地网关使用,可以直接全局安装:
|
|
73
|
+
### Chat Completions
|
|
128
74
|
|
|
129
75
|
```bash
|
|
130
|
-
|
|
76
|
+
curl http://127.0.0.1:8787/v1/chat/completions \
|
|
77
|
+
-H "content-type: application/json" \
|
|
78
|
+
-d '{
|
|
79
|
+
"model": "gpt-5.4",
|
|
80
|
+
"messages": [
|
|
81
|
+
{
|
|
82
|
+
"role": "user",
|
|
83
|
+
"content": "Reply with OK only."
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}'
|
|
131
87
|
```
|
|
132
88
|
|
|
133
|
-
|
|
89
|
+
### Image Generation
|
|
134
90
|
|
|
135
91
|
```bash
|
|
136
|
-
|
|
137
|
-
|
|
92
|
+
curl http://127.0.0.1:8787/v1/images/generations \
|
|
93
|
+
-H "content-type: application/json" \
|
|
94
|
+
-d '{
|
|
95
|
+
"model": "gpt-image-2",
|
|
96
|
+
"prompt": "A clean product photo of a red apple on a white background.",
|
|
97
|
+
"size": "1024x1024",
|
|
98
|
+
"quality": "low",
|
|
99
|
+
"response_format": "b64_json"
|
|
100
|
+
}'
|
|
138
101
|
```
|
|
139
102
|
|
|
140
|
-
|
|
103
|
+
The gateway returns an OpenAI-style response with `data[].b64_json`.
|
|
141
104
|
|
|
142
|
-
-
|
|
105
|
+

|
|
143
106
|
|
|
144
|
-
|
|
107
|
+
### Image Editing
|
|
145
108
|
|
|
146
|
-
|
|
109
|
+
`/v1/images/edits` currently supports JSON requests with URL, data URL, or raw base64 image references:
|
|
147
110
|
|
|
148
111
|
```bash
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
112
|
+
curl http://127.0.0.1:8787/v1/images/edits \
|
|
113
|
+
-H "content-type: application/json" \
|
|
114
|
+
-d '{
|
|
115
|
+
"model": "gpt-image-2",
|
|
116
|
+
"prompt": "Use this reference image and create a cleaner product advertisement version.",
|
|
117
|
+
"images": [
|
|
118
|
+
{
|
|
119
|
+
"image_url": "data:image/png;base64,REPLACE_WITH_IMAGE_BASE64"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"size": "1024x1024",
|
|
123
|
+
"quality": "low",
|
|
124
|
+
"response_format": "b64_json"
|
|
125
|
+
}'
|
|
162
126
|
```
|
|
163
127
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
接下来在管理页里完成这几件事:
|
|
128
|
+
More examples are available in [docs/API_USAGE.md](docs/API_USAGE.md).
|
|
167
129
|
|
|
168
|
-
|
|
169
|
-
- 查看当前账号状态和过期时间
|
|
170
|
-
- 在已保存账号之间切换当前使用账号
|
|
171
|
-
- 切换默认模型
|
|
172
|
-
- 直接测试 `models`、`responses`、`chat.completions`
|
|
173
|
-
- 直接测试 `images.generations` 生图接口
|
|
130
|
+
## Account Management
|
|
174
131
|
|
|
175
|
-
|
|
132
|
+
AI Zero Token stores account state locally under:
|
|
176
133
|
|
|
177
134
|
```text
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Vibe Coding、OpenAI-compatible SDK 和脚本接入可以参考:
|
|
182
|
-
|
|
183
|
-
- [API 使用说明](docs/API_USAGE.md)
|
|
184
|
-
|
|
185
|
-
如果你要让本地网页直接从浏览器请求这个网关,现在已经默认开启 CORS。
|
|
186
|
-
|
|
187
|
-
如需限制来源,可以在启动前指定:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
AZT_CORS_ORIGIN=http://127.0.0.1:8124 azt start
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
多个来源可用英文逗号分隔:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
AZT_CORS_ORIGIN=http://127.0.0.1:8124,http://localhost:3000 azt start
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
如果你当前还没有全局命令,也可以把上面的 `azt` 临时替换成:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
bun src/cli.ts
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
例如:`bun src/cli.ts start`
|
|
206
|
-
|
|
207
|
-
## 网关使用说明
|
|
208
|
-
|
|
209
|
-
如果你主要把 AI Zero Token 当作本地网关来使用,推荐只记住一个命令:
|
|
210
|
-
|
|
211
|
-
### 1. 启动
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
azt start
|
|
135
|
+
~/.ai-zero-token/.state
|
|
215
136
|
```
|
|
216
137
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
- 触发 OpenAI Codex OAuth 登录并新增账号
|
|
220
|
-
- 查看当前账号、已保存账号列表、过期时间、token 摘要
|
|
221
|
-
- 查看账号套餐 plan 和当前账号是否支持生图
|
|
222
|
-
- 在多个已保存账号之间切换当前使用账号
|
|
223
|
-
- 在“新增账号”里选择 OAuth 登录,或粘贴外部账号 JSON 批量导入
|
|
224
|
-
- 导出单个账号,或勾选多个账号后批量导出所选账号 JSON
|
|
225
|
-
- 删除单个本地账号,或一键清空全部本地账号
|
|
226
|
-
- 切换默认模型
|
|
227
|
-
- 测试 `models` / `responses` / `chat.completions`
|
|
228
|
-
- 测试 `images.generations`
|
|
138
|
+
The web console supports:
|
|
229
139
|
|
|
230
|
-
|
|
140
|
+
- OAuth login.
|
|
141
|
+
- JSON import from a single profile, an array, or a `profiles` bundle.
|
|
142
|
+
- Single-account export.
|
|
143
|
+
- Selected batch export using checkboxes.
|
|
144
|
+
- Account deletion and active-account switching.
|
|
231
145
|
|
|
232
|
-
|
|
146
|
+
Exported account JSON includes authentication tokens and should be treated as a secret.
|
|
233
147
|
|
|
234
|
-
|
|
148
|
+
### Apply to Codex
|
|
235
149
|
|
|
236
|
-
|
|
150
|
+
The `Apply to Codex` action writes the selected account to:
|
|
237
151
|
|
|
238
152
|
```text
|
|
239
|
-
|
|
153
|
+
~/.codex/auth.json
|
|
240
154
|
```
|
|
241
155
|
|
|
242
|
-
|
|
156
|
+
Before writing, the existing file is backed up as `auth.json.azt-backup-*`. New Codex sessions will use the applied account.
|
|
243
157
|
|
|
244
|
-
|
|
245
|
-
http://127.0.0.1:8787
|
|
246
|
-
```
|
|
158
|
+
## Configuration
|
|
247
159
|
|
|
248
|
-
|
|
160
|
+
Default listener:
|
|
249
161
|
|
|
250
162
|
```text
|
|
251
|
-
|
|
163
|
+
0.0.0.0:8787
|
|
252
164
|
```
|
|
253
165
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
客户端或 SDK 里把 Base URL 改成:
|
|
166
|
+
Local gateway base URL:
|
|
257
167
|
|
|
258
168
|
```text
|
|
259
169
|
http://127.0.0.1:8787/v1
|
|
260
170
|
```
|
|
261
171
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
### 3. 查看模型列表
|
|
265
|
-
|
|
266
|
-
OpenAI 风格模型接口:
|
|
172
|
+
Restrict browser CORS origins:
|
|
267
173
|
|
|
268
174
|
```bash
|
|
269
|
-
|
|
175
|
+
AZT_CORS_ORIGIN=http://127.0.0.1:8124 azt start
|
|
270
176
|
```
|
|
271
177
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
最小请求示例:
|
|
178
|
+
Multiple origins can be separated by commas:
|
|
275
179
|
|
|
276
180
|
```bash
|
|
277
|
-
|
|
278
|
-
-H "content-type: application/json" \
|
|
279
|
-
-d '{"model":"gpt-5.4","input":"请只回复 OK"}'
|
|
181
|
+
AZT_CORS_ORIGIN=http://127.0.0.1:8124,http://localhost:3000 azt start
|
|
280
182
|
```
|
|
281
183
|
|
|
282
|
-
|
|
184
|
+
The persistent state directory can be overridden with:
|
|
283
185
|
|
|
284
186
|
```bash
|
|
285
|
-
|
|
286
|
-
-H "content-type: application/json" \
|
|
287
|
-
-d '{"model":"gpt-5.4","instructions":"你是一个简洁助手","input":"请只回复 OK"}'
|
|
187
|
+
AI_ZERO_TOKEN_HOME=/path/to/home azt start
|
|
288
188
|
```
|
|
289
189
|
|
|
290
|
-
|
|
190
|
+
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:
|
|
291
191
|
|
|
292
192
|
```bash
|
|
293
|
-
|
|
294
|
-
-H "content-type: application/json" \
|
|
295
|
-
-d '{
|
|
296
|
-
"model": "gpt-5.4",
|
|
297
|
-
"messages": [
|
|
298
|
-
{
|
|
299
|
-
"role": "user",
|
|
300
|
-
"content": "请只回复 OK"
|
|
301
|
-
}
|
|
302
|
-
]
|
|
303
|
-
}'
|
|
193
|
+
AZT_BODY_LIMIT_MB=64 azt start
|
|
304
194
|
```
|
|
305
195
|
|
|
306
|
-
|
|
196
|
+
## Image Limits
|
|
307
197
|
|
|
308
|
-
|
|
198
|
+
ChatGPT Images availability and limits are controlled by the upstream account. Free accounts can attempt image generation, but rate limits and feature availability are stricter than paid plans and are not published as fixed public numbers. The gateway forwards image requests and surfaces the upstream response, for example `usage_limit_reached` with reset information.
|
|
309
199
|
|
|
310
|
-
|
|
311
|
-
curl http://127.0.0.1:8787/v1/images/generations \
|
|
312
|
-
-H "content-type: application/json" \
|
|
313
|
-
-d '{
|
|
314
|
-
"model": "gpt-image-2",
|
|
315
|
-
"prompt": "生成一张白底红苹果商品图,构图简洁,光线干净。",
|
|
316
|
-
"size": "1024x1024",
|
|
317
|
-
"quality": "low",
|
|
318
|
-
"response_format": "b64_json"
|
|
319
|
-
}'
|
|
320
|
-
```
|
|
200
|
+
Image requests use `gpt-5.4-mini` as the internal orchestration model and pass the requested image model, such as `gpt-image-2`, to the `image_generation` tool.
|
|
321
201
|
|
|
322
|
-
|
|
323
|
-
如果请求里不显式传 `model`,当前默认会使用 `gpt-image-2`。
|
|
324
|
-
|
|
325
|
-
生图能力和账号套餐有关:
|
|
326
|
-
|
|
327
|
-
- `plus` 或更高套餐账号可正常调用 `images.generations`
|
|
328
|
-
- `free` 账号不支持生图,网关会直接返回明确错误,而不是继续请求上游
|
|
329
|
-
- 管理页会显示当前账号的 `plan` 和“生图能力”状态
|
|
330
|
-
- 当当前账号是 `free` 且你选中 `Images` 测试时,“发送请求”按钮会被直接禁用
|
|
331
|
-
|
|
332
|
-
### 6. 当前支持的接口
|
|
333
|
-
|
|
334
|
-
- `GET /_gateway/health`
|
|
335
|
-
- `GET /_gateway/status`
|
|
336
|
-
- `GET /_gateway/models`
|
|
337
|
-
- `POST /_gateway/models/refresh`
|
|
338
|
-
- `GET /_gateway/admin/config`
|
|
339
|
-
- `POST /_gateway/admin/login`
|
|
340
|
-
- `POST /_gateway/admin/logout`
|
|
341
|
-
- `POST /_gateway/admin/profiles/activate`
|
|
342
|
-
- `POST /_gateway/admin/profiles/remove`
|
|
343
|
-
- `PUT /_gateway/admin/settings`
|
|
344
|
-
- `GET /v1/models`
|
|
345
|
-
- `POST /v1/responses`
|
|
346
|
-
- `POST /v1/chat/completions`
|
|
347
|
-
- `POST /v1/images/generations`
|
|
348
|
-
|
|
349
|
-
### 7. 当前支持的主要参数
|
|
350
|
-
|
|
351
|
-
`POST /v1/responses` 当前主要支持:
|
|
352
|
-
|
|
353
|
-
- `model`
|
|
354
|
-
- `input`
|
|
355
|
-
- `instructions`
|
|
356
|
-
- `stream`
|
|
357
|
-
- `tools`
|
|
358
|
-
- `tool_choice`
|
|
359
|
-
- `include`
|
|
360
|
-
- `text`
|
|
361
|
-
- `store`
|
|
362
|
-
- `parallel_tool_calls`
|
|
363
|
-
- `experimental_codex.body`
|
|
364
|
-
- `experimental_codex.allow_unknown_model`
|
|
365
|
-
- `experimental_codex.include_raw`
|
|
366
|
-
|
|
367
|
-
`POST /v1/chat/completions` 当前主要支持:
|
|
368
|
-
|
|
369
|
-
- `model`
|
|
370
|
-
- `messages`
|
|
371
|
-
- `tools`
|
|
372
|
-
- `tool_choice`
|
|
373
|
-
- `response_format`
|
|
374
|
-
- `temperature`
|
|
375
|
-
- `top_p`
|
|
376
|
-
- `presence_penalty`
|
|
377
|
-
- `frequency_penalty`
|
|
378
|
-
- `metadata`
|
|
379
|
-
- `stop`
|
|
380
|
-
- `store`
|
|
381
|
-
- `parallel_tool_calls`
|
|
382
|
-
|
|
383
|
-
`POST /v1/images/generations` 当前主要支持:
|
|
384
|
-
|
|
385
|
-
- `prompt`
|
|
386
|
-
- `model`
|
|
387
|
-
- `n`
|
|
388
|
-
- `size`
|
|
389
|
-
- `quality`
|
|
390
|
-
- `background`
|
|
391
|
-
- `output_format`
|
|
392
|
-
- `output_compression`
|
|
393
|
-
- `moderation`
|
|
394
|
-
- `response_format`
|
|
395
|
-
- `user`
|
|
396
|
-
|
|
397
|
-
### 8. 当前限制
|
|
398
|
-
|
|
399
|
-
- `stream=true` 目前只识别,不返回真实流式结果
|
|
400
|
-
- 还没有完整覆盖 OpenAI Responses API 的全部字段
|
|
401
|
-
- `chat.completions` 暂不支持 `n > 1`
|
|
402
|
-
- `images.generations` 暂不支持 `n > 1`
|
|
403
|
-
- `images.generations` 当前只返回 `b64_json`,暂不支持托管图片 `url`
|
|
404
|
-
- `images.generations` 当前只透传 GPT Image 路径,不兼容 DALL·E 专有参数
|
|
405
|
-
- `images.generations` 对账号套餐有要求;`free` 账号会被网关直接拦截并返回“不支持图片生成”
|
|
406
|
-
- 网关当前默认面向本地单用户使用
|
|
407
|
-
|
|
408
|
-
## 兼容说明
|
|
409
|
-
|
|
410
|
-
代码里仍然保留了 `login`、`status`、`models`、`profiles`、`ask`、`serve`、`clear` 等 CLI 命令,主要用于调试、兼容和后续扩展。
|
|
411
|
-
|
|
412
|
-
账号 JSON 也可以通过 CLI 导入/导出:
|
|
202
|
+
For JSON image editing, base64 payloads are about 33% larger than the original image. With the default `32 MiB` body limit, a raw image around `24 MiB` is the practical upper bound before JSON overhead. For larger images or batch workflows, prefer a reachable image URL.
|
|
413
203
|
|
|
414
|
-
|
|
415
|
-
azt profiles import ./profile.json
|
|
416
|
-
azt profiles export active ./profile.json
|
|
417
|
-
azt profiles export all ./profiles.json
|
|
418
|
-
azt profiles export "openai-codex:<accountId>" ./profile.json
|
|
419
|
-
```
|
|
204
|
+
## Limitations
|
|
420
205
|
|
|
421
|
-
|
|
206
|
+
- This project is intended for local single-user use.
|
|
207
|
+
- Streaming request fields are recognized, but full streaming parity is not implemented for every endpoint.
|
|
208
|
+
- `/v1/images/generations` currently returns `b64_json`; hosted image URLs are not supported.
|
|
209
|
+
- `/v1/images/generations` does not support `n > 1`.
|
|
210
|
+
- `/v1/images/edits` currently supports JSON only. `multipart/form-data`, `mask`, and `file_id` are not yet supported.
|
|
211
|
+
- Very large base64 JSON requests are constrained by `AZT_BODY_LIMIT_MB` and local memory.
|
|
212
|
+
- OpenAI Responses API compatibility is partial and focused on common local client workflows.
|
|
422
213
|
|
|
423
|
-
|
|
424
|
-
azt start
|
|
425
|
-
```
|
|
214
|
+
## Security
|
|
426
215
|
|
|
427
|
-
|
|
216
|
+
- Access tokens, refresh tokens, and ID tokens are equivalent to login credentials.
|
|
217
|
+
- Do not expose the gateway to untrusted networks.
|
|
218
|
+
- Do not share exported account JSON outside trusted environments.
|
|
219
|
+
- Review files under `~/.ai-zero-token/.state` and `~/.codex/auth.json` before copying or publishing local data.
|
|
428
220
|
|
|
429
|
-
|
|
221
|
+
## Development
|
|
430
222
|
|
|
431
|
-
|
|
432
|
-
- 微信交流:先加我微信,备注 `AI Zero Token`,我会再拉你进交流群
|
|
223
|
+
Install dependencies:
|
|
433
224
|
|
|
434
|
-
|
|
225
|
+
```bash
|
|
226
|
+
npm install
|
|
227
|
+
```
|
|
435
228
|
|
|
436
|
-
|
|
229
|
+
Run from source:
|
|
437
230
|
|
|
438
|
-
|
|
231
|
+
```bash
|
|
232
|
+
bun src/cli.ts start
|
|
233
|
+
```
|
|
439
234
|
|
|
440
|
-
|
|
235
|
+
Validate:
|
|
441
236
|
|
|
442
|
-
|
|
443
|
-
|
|
237
|
+
```bash
|
|
238
|
+
npm run typecheck
|
|
239
|
+
npm run build
|
|
240
|
+
```
|
|
444
241
|
|
|
445
|
-
|
|
242
|
+
CLI packaging and release notes are documented in [BUILD_CLI.md](BUILD_CLI.md). User-facing changes are tracked in [CHANGELOG.md](CHANGELOG.md).
|
|
446
243
|
|
|
447
|
-
|
|
448
|
-
- 默认模型和服务配置
|
|
244
|
+
## Project Status
|
|
449
245
|
|
|
450
|
-
|
|
246
|
+
AI Zero Token is evolving quickly. The current focus is a reliable local gateway, account transfer workflows, and image generation/editing compatibility for OpenAI-style clients.
|
|
451
247
|
|
|
452
|
-
|
|
453
|
-
CLI 命令解析和命令分发
|
|
454
|
-
- `src/core/`
|
|
455
|
-
核心业务逻辑
|
|
456
|
-
- `src/core/services/`
|
|
457
|
-
认证、模型、聊天、配置服务
|
|
458
|
-
- `src/core/store/`
|
|
459
|
-
本地状态读写
|
|
460
|
-
- `src/core/providers/openai-codex/`
|
|
461
|
-
OpenAI Codex provider 实现
|
|
462
|
-
- `src/server/`
|
|
463
|
-
本地 HTTP 网关
|
|
248
|
+
Issues and feature requests: [GitHub Issues](https://github.com/fchangjun/AI-Zero-Token/issues)
|