ai-zero-token 1.0.7 → 1.0.9

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 CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 1.0.7 - 2026-04-29
4
12
 
5
13
  - Added JSON `POST /v1/images/edits` support for image-to-image workflows with URL, base64 data URL, or raw base64 image references.
package/README.md CHANGED
@@ -1,507 +1,258 @@
1
1
  # AI Zero Token
2
2
 
3
- > 实验工具,不建议直接作为生产环境网关使用。
3
+ [English](README.md) | [简体中文](README.zh-CN.md)
4
4
 
5
- AI Zero Token 是一个本地优先的单用户 AI CLI 和本地网关。
5
+ Local-first OpenAI-compatible gateway for ChatGPT/Codex OAuth accounts.
6
6
 
7
- 它把账号授权能力整理成 OpenAI 风格接口,重点是把图片生成能力也代理出来:
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
- - `POST /v1/images/generations`
10
- - `POST /v1/images/edits`
11
- - `POST /v1/responses`
12
- - `POST /v1/chat/completions`
13
- - `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.
14
10
 
15
- 很多用户已经有 ChatGPT 之类产品的账号、订阅或可用授权能力,但缺少一个统一、可脚本化、可本地集成的入口。AI Zero Token 要做的,就是把这类已有授权能力整理成一个可直接使用的命令行工具和本地接口。
11
+ ## Features
16
12
 
17
- ## 这次迭代亮点
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 quota-exhaustion auto switch to the next saved API account with available quota.
25
+ - Optional upstream proxy configuration for OAuth, model refresh, and gateway forwarding.
26
+ - Local model discovery from the Codex model cache with manual refresh support.
18
27
 
19
- - 直接代理 `gpt-image-2`,把图片生成能力暴露成 OpenAI 风格 `images.generations` / `images.edits` 接口
20
- - 启动 `azt start` 后即可获得本地管理页和本地网关,适合脚本、前端和自动化流程接入
21
- - 支持多账号保存、切换当前账号、查看账号套餐 plan,以及当前账号是否支持生图
22
- - 支持账号 JSON 批量导入/勾选导出,并可一键把已保存账号应用到本机 Codex
23
- - 模型列表会优先同步本机 `~/.codex/models_cache.json`,不需要每次为新模型重新 build
24
- - 管理页会每 10 分钟自动同步额度快照和版本状态,并提示当前版本是否可更新
25
- - `free` 账号会在管理页直接预警,并在网关层明确拦截生图请求
28
+ ## Architecture
26
29
 
27
- 如果你只关心一句话,可以把这个项目理解为:
30
+ ![AI Zero Token architecture](docs/images/architecture-diagram.png)
28
31
 
29
- > 一个把账号授权能力代理成本地 OpenAI 风格接口的实验工具,这次重点补齐了 `gpt-image-2` 生图接口。
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.
30
33
 
31
- ## 一条命令开始
34
+ ## Quick Start
32
35
 
33
36
  ```bash
34
37
  npm install -g ai-zero-token
35
38
  azt start
36
39
  ```
37
40
 
38
- 启动后会打开本地管理页,并暴露 OpenAI 风格接口:
41
+ The command starts the local web console and gateway:
39
42
 
40
43
  ```text
44
+ http://127.0.0.1:8787
41
45
  http://127.0.0.1:8787/v1
42
46
  ```
43
47
 
44
- ## 界面预览
45
-
46
- ![AI Zero Token 管理页预览](docs/images/admin-dashboard.jpg)
47
-
48
- ## 生图结果预览
49
-
50
- 下图通过 AI Zero Token 本地网关调用 `POST /v1/images/generations` 生成,模型为 `gpt-image-2`。
51
-
52
- ![AI Zero Token gpt-image-2 生图结果预览](docs/images/gpt-image-2-preview.png)
53
-
54
- ## 为什么做这个项目
55
-
56
- 如果你只是想在自己的电脑上更低门槛地接入主流 LLM,现实里通常会遇到这几个问题:
57
-
58
- - 已经有产品订阅,但还没有开发者 API 方案
59
- - 想把能力接入自己的脚本、前端、本地工作流,但不想每次都手工操作网页
60
- - 想统一本地调用方式,而不是每家产品各写一套接入逻辑
61
- - 想学习 OAuth、CLI、网关、npm CLI、桌面端这类真实工程能力
62
-
63
- AI Zero Token 就是围绕这些问题设计的。
64
-
65
- ## 它能解决什么
66
-
67
- - 想把 ChatGPT 的图片生成能力接到自己的前端、小工具或脚本里
68
- - 想先用本地网关验证产品原型,而不是一上来就重做整套后端
69
- - 想统一成 OpenAI 风格接口,减少接入成本
70
- - 想研究一条完整的 OAuth -> token -> 本地状态 -> 网关 -> 上游请求链路
71
-
72
- ## 架构概览
73
-
74
- ![AI Zero Token 实验工具架构图](docs/images/architecture-diagram.png)
75
-
76
- ## 当前能做什么
77
-
78
- - 通过 `POST /v1/images/generations` 代理 `gpt-image-2` 生图请求
79
- - 通过 OpenAI Codex OAuth 登录
80
- - 在本地保存 `access_token` 和 `refresh_token`
81
- - 支持保存多个账号 profile,并手动切换当前生效账号
82
- - 在 token 过期时自动刷新
83
- - 通过 `azt start` 一键启动本地 HTTP 网关和管理页面
84
- - 在管理页面里完成多账号登录、查看账号状态、切换当前账号、切换默认模型、测试接口
85
- - 模型列表优先读取本机 Codex 最新缓存,并支持在 CLI / 管理页手动同步
86
- - 暴露 OpenAI 风格接口:
87
- - `GET /v1/models`
88
- - `POST /v1/responses`
89
- - `POST /v1/chat/completions`
90
- - `POST /v1/images/generations`
91
-
92
- ## 适合谁用
48
+ Use any non-empty API key value when a client requires one. Authentication is handled by the local gateway.
93
49
 
94
- - 想把账号授权能力包装成本地工具的人
95
- - 想把 `gpt-image-2` 生图接口直接接给脚本、前端或自动化流程的人
96
- - 想做自己的 AI 网关、AI CLI、AI 桌面端的人
97
- - 想学习一条完整 OAuth -> token -> CLI -> HTTP API 链路的人
98
- - 想把 AI 能力接入脚本、前端或自动化流程的人
50
+ ## Web Console
99
51
 
52
+ The web console is the recommended entry point:
100
53
 
101
- ## 环境要求
54
+ - Log in with OpenAI Codex OAuth.
55
+ - Import one or more account JSON files.
56
+ - Switch the active account.
57
+ - Export one account or selected accounts.
58
+ - Apply a saved account to local Codex.
59
+ - Configure the default text model and upstream proxy.
60
+ - Enable automatic account switching when the active API account has exhausted its recorded quota.
61
+ - Test `models`, `responses`, `chat.completions`, `images.generations`, and `images.edits`.
102
62
 
103
- - Node.js 22+ 推荐
104
- - Bun 可用于开发和直接运行源码
105
- - 终端网络需要可访问:
106
- - `https://auth.openai.com`
107
- - `https://chatgpt.com`
63
+ ![AI Zero Token admin dashboard](docs/images/admin-dashboard.jpg)
108
64
 
109
- ## 安装与运行
65
+ ## API Usage
110
66
 
111
- ### 从源码运行
112
-
113
- 克隆仓库并安装依赖:
67
+ ### Models
114
68
 
115
69
  ```bash
116
- git clone https://github.com/fchangjun/AI-Zero-Token.git
117
- cd AI-Zero-Token
118
- npm install
70
+ curl http://127.0.0.1:8787/v1/models
119
71
  ```
120
72
 
121
- 直接运行源码:
73
+ ### Responses
122
74
 
123
75
  ```bash
124
- bun src/cli.ts start
76
+ curl http://127.0.0.1:8787/v1/responses \
77
+ -H "content-type: application/json" \
78
+ -d '{"model":"gpt-5.4","input":"Reply with OK only."}'
125
79
  ```
126
80
 
127
- ### npm 安装 CLI
128
-
129
- 如果你只是想把它当作本地 CLI 和本地网关使用,可以直接全局安装:
81
+ ### Chat Completions
130
82
 
131
83
  ```bash
132
- npm install -g ai-zero-token
84
+ curl http://127.0.0.1:8787/v1/chat/completions \
85
+ -H "content-type: application/json" \
86
+ -d '{
87
+ "model": "gpt-5.4",
88
+ "messages": [
89
+ {
90
+ "role": "user",
91
+ "content": "Reply with OK only."
92
+ }
93
+ ]
94
+ }'
133
95
  ```
134
96
 
135
- 安装后验证:
97
+ ### Image Generation
136
98
 
137
99
  ```bash
138
- azt start
139
- azt models --refresh
100
+ curl http://127.0.0.1:8787/v1/images/generations \
101
+ -H "content-type: application/json" \
102
+ -d '{
103
+ "model": "gpt-image-2",
104
+ "prompt": "A clean product photo of a red apple on a white background.",
105
+ "size": "1024x1024",
106
+ "quality": "low",
107
+ "response_format": "b64_json"
108
+ }'
140
109
  ```
141
110
 
142
- 如果你是为了开发、构建、`npm link`、`npm pack` 或准备发布,单独看:
111
+ The gateway returns an OpenAI-style response with `data[].b64_json`.
143
112
 
144
- - `BUILD_CLI.md`
113
+ ![AI Zero Token gpt-image-2 output preview](docs/images/gpt-image-2-preview.png)
145
114
 
146
- ## 快速开始
115
+ ### Image Editing
147
116
 
148
- 启动本地网关和管理页面:
117
+ `/v1/images/edits` currently supports JSON requests with URL, data URL, or raw base64 image references:
149
118
 
150
119
  ```bash
151
- azt start
152
- ```
153
-
154
- 执行后会自动打开管理页,默认地址:
155
-
156
- ```text
157
- http://127.0.0.1:8787
158
- ```
159
-
160
- 默认会监听:
161
-
162
- ```text
163
- 0.0.0.0:8787
120
+ curl http://127.0.0.1:8787/v1/images/edits \
121
+ -H "content-type: application/json" \
122
+ -d '{
123
+ "model": "gpt-image-2",
124
+ "prompt": "Use this reference image and create a cleaner product advertisement version.",
125
+ "images": [
126
+ {
127
+ "image_url": "data:image/png;base64,REPLACE_WITH_IMAGE_BASE64"
128
+ }
129
+ ],
130
+ "size": "1024x1024",
131
+ "quality": "low",
132
+ "response_format": "b64_json"
133
+ }'
164
134
  ```
165
135
 
166
- 这表示本机可以用 `127.0.0.1:8787` 访问,局域网内其他设备也可以用你的机器 IP 访问,比如 `http://172.26.66.132:8787`。
167
-
168
- 接下来在管理页里完成这几件事:
136
+ More examples are available in [docs/API_USAGE.md](docs/API_USAGE.md).
169
137
 
170
- - 登录一个或多个 OpenAI Codex 账号
171
- - 查看当前账号状态和过期时间
172
- - 在已保存账号之间切换当前使用账号
173
- - 切换默认模型
174
- - 直接测试 `models`、`responses`、`chat.completions`
175
- - 直接测试 `images.generations` 生图接口
138
+ ## Account Management
176
139
 
177
- 如果你要把它接到自己的客户端,只需要把 Base URL 指向:
140
+ AI Zero Token stores account state locally under:
178
141
 
179
142
  ```text
180
- http://127.0.0.1:8787/v1
143
+ ~/.ai-zero-token/.state
181
144
  ```
182
145
 
183
- Vibe Coding、OpenAI-compatible SDK 和脚本接入可以参考:
146
+ The web console supports:
184
147
 
185
- - [API 使用说明](docs/API_USAGE.md)
148
+ - OAuth login.
149
+ - JSON import from a single profile, an array, or a `profiles` bundle.
150
+ - Single-account export.
151
+ - Selected batch export using checkboxes.
152
+ - Account deletion and active-account switching.
186
153
 
187
- 如果你要让本地网页直接从浏览器请求这个网关,现在已经默认开启 CORS。
154
+ Exported account JSON includes authentication tokens and should be treated as a secret.
188
155
 
189
- 如需限制来源,可以在启动前指定:
190
-
191
- ```bash
192
- AZT_CORS_ORIGIN=http://127.0.0.1:8124 azt start
193
- ```
156
+ ### Apply to Codex
194
157
 
195
- 多个来源可用英文逗号分隔:
158
+ The `Apply to Codex` action writes the selected account to:
196
159
 
197
- ```bash
198
- AZT_CORS_ORIGIN=http://127.0.0.1:8124,http://localhost:3000 azt start
199
- ```
200
-
201
- 如果你当前还没有全局命令,也可以把上面的 `azt` 临时替换成:
202
-
203
- ```bash
204
- bun src/cli.ts
205
- ```
206
-
207
- 例如:`bun src/cli.ts start`
208
-
209
- ## 网关使用说明
210
-
211
- 如果你主要把 AI Zero Token 当作本地网关来使用,推荐只记住一个命令:
212
-
213
- ### 1. 启动
214
-
215
- ```bash
216
- azt start
160
+ ```text
161
+ ~/.codex/auth.json
217
162
  ```
218
163
 
219
- 启动后会自动打开管理页。管理页就是默认工作入口,你可以在里面直接:
220
-
221
- - 触发 OpenAI Codex OAuth 登录并新增账号
222
- - 查看当前账号、已保存账号列表、过期时间、token 摘要
223
- - 查看账号套餐 plan 和当前账号是否支持生图
224
- - 在多个已保存账号之间切换当前使用账号
225
- - 在“新增账号”里选择 OAuth 登录,或粘贴外部账号 JSON 批量导入
226
- - 导出单个账号,或勾选多个账号后批量导出所选账号 JSON
227
- - 将任一已保存账号“应用到 Codex”,自动备份并更新本机 `~/.codex/auth.json`
228
- - 删除单个本地账号,或一键清空全部本地账号
229
- - 切换默认模型
230
- - 测试 `models` / `responses` / `chat.completions`
231
- - 测试 `images.generations`
232
-
233
- 管理页里邮箱默认脱敏显示,需要手动点击“查看邮箱”才会显示明文。
234
-
235
- 导出的账号 JSON 包含完整 `access_token` 和 `refresh_token`,等同于账号登录凭据,只适合在可信环境中传递。
236
-
237
- 账号卡片里的“应用到 Codex”会把该账号的 `access_token`、`refresh_token`、`id_token` 和 `account_id` 写入本机 Codex 的 `~/.codex/auth.json`。写入前会自动备份原文件;新开的 Codex 会话会使用该账号。
164
+ Before writing, the existing file is backed up as `auth.json.azt-backup-*`. New Codex sessions will use the applied account.
238
165
 
239
- 如果当前网络访问海外上游不稳定,可以在管理页的“接口测试 / 系统设置”区域启用“上游代理”,并填写你自己的代理地址。保存后,OAuth 换取 token、模型刷新和接口转发都会通过该代理访问上游;本地管理页和 `127.0.0.1` 默认保持直连。
166
+ ## Configuration
240
167
 
241
- 默认监听地址:
168
+ Default listener:
242
169
 
243
170
  ```text
244
- http://0.0.0.0:8787
171
+ 0.0.0.0:8787
245
172
  ```
246
173
 
247
- 本机浏览器访问:
174
+ Local gateway base URL:
248
175
 
249
176
  ```text
250
- http://127.0.0.1:8787
177
+ http://127.0.0.1:8787/v1
251
178
  ```
252
179
 
253
- 默认 CORS 来源:
180
+ Restrict browser CORS origins:
254
181
 
255
- ```text
256
- *
182
+ ```bash
183
+ AZT_CORS_ORIGIN=http://127.0.0.1:8124 azt start
257
184
  ```
258
185
 
259
- ### 2. 把它接到你的客户端
260
-
261
- 客户端或 SDK 里把 Base URL 改成:
186
+ Multiple origins can be separated by commas:
262
187
 
263
- ```text
264
- http://127.0.0.1:8787/v1
188
+ ```bash
189
+ AZT_CORS_ORIGIN=http://127.0.0.1:8124,http://localhost:3000 azt start
265
190
  ```
266
191
 
267
- 如果客户端必须填写 API Key,可以填任意非空占位值;真正起作用的是本地网关地址。
268
-
269
- ### 3. 查看模型列表
270
-
271
- OpenAI 风格模型接口:
192
+ The persistent state directory can be overridden with:
272
193
 
273
194
  ```bash
274
- curl http://127.0.0.1:8787/v1/models
195
+ AI_ZERO_TOKEN_HOME=/path/to/home azt start
275
196
  ```
276
197
 
277
- ### 4. 调用对话接口
198
+ 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.
278
199
 
279
- 最小请求示例:
200
+ 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:
280
201
 
281
202
  ```bash
282
- curl http://127.0.0.1:8787/v1/responses \
283
- -H "content-type: application/json" \
284
- -d '{"model":"gpt-5.4","input":"请只回复 OK"}'
203
+ AZT_BODY_LIMIT_MB=64 azt start
285
204
  ```
286
205
 
287
- `instructions` 的请求示例:
206
+ ## Image Limits
288
207
 
289
- ```bash
290
- curl http://127.0.0.1:8787/v1/responses \
291
- -H "content-type: application/json" \
292
- -d '{"model":"gpt-5.4","instructions":"你是一个简洁助手","input":"请只回复 OK"}'
293
- ```
208
+ 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.
294
209
 
295
- 兼容 `chat.completions` 的最小请求示例:
210
+ 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.
296
211
 
297
- ```bash
298
- curl http://127.0.0.1:8787/v1/chat/completions \
299
- -H "content-type: application/json" \
300
- -d '{
301
- "model": "gpt-5.4",
302
- "messages": [
303
- {
304
- "role": "user",
305
- "content": "请只回复 OK"
306
- }
307
- ]
308
- }'
309
- ```
212
+ 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.
310
213
 
311
- ### 5. 调用生图接口
214
+ ## Limitations
312
215
 
313
- OpenAI 风格 `images.generations` 示例:
216
+ - This project is intended for local single-user use.
217
+ - Streaming request fields are recognized, but full streaming parity is not implemented for every endpoint.
218
+ - `/v1/images/generations` currently returns `b64_json`; hosted image URLs are not supported.
219
+ - `/v1/images/generations` does not support `n > 1`.
220
+ - `/v1/images/edits` currently supports JSON only. `multipart/form-data`, `mask`, and `file_id` are not yet supported.
221
+ - Very large base64 JSON requests are constrained by `AZT_BODY_LIMIT_MB` and local memory.
222
+ - OpenAI Responses API compatibility is partial and focused on common local client workflows.
314
223
 
315
- ```bash
316
- curl http://127.0.0.1:8787/v1/images/generations \
317
- -H "content-type: application/json" \
318
- -d '{
319
- "model": "gpt-image-2",
320
- "prompt": "生成一张白底红苹果商品图,构图简洁,光线干净。",
321
- "size": "1024x1024",
322
- "quality": "low",
323
- "response_format": "b64_json"
324
- }'
325
- ```
224
+ ## Security
225
+
226
+ - Access tokens, refresh tokens, and ID tokens are equivalent to login credentials.
227
+ - Do not expose the gateway to untrusted networks.
228
+ - Do not share exported account JSON outside trusted environments.
229
+ - Review files under `~/.ai-zero-token/.state` and `~/.codex/auth.json` before copying or publishing local data.
326
230
 
327
- 响应会返回 OpenAI 同类型结构的 `data[].b64_json`。如果你在管理页里测试,这张图片会直接显示预览。
328
- 如果请求里不显式传 `model`,当前默认会使用 `gpt-image-2`。
231
+ ## Development
329
232
 
330
- JSON 版 `images.edits` 支持通过 URL 或 base64 data URL 传参考图:
233
+ Install dependencies:
331
234
 
332
235
  ```bash
333
- curl http://127.0.0.1:8787/v1/images/edits \
334
- -H "content-type: application/json" \
335
- -d '{
336
- "model": "gpt-image-2",
337
- "prompt": "参考这张图,生成一张更适合科技产品广告的版本。",
338
- "images": [
339
- {
340
- "image_url": "data:image/png;base64,替换为你的图片base64"
341
- }
342
- ],
343
- "size": "1024x1024",
344
- "quality": "low",
345
- "response_format": "b64_json"
346
- }'
236
+ npm install
347
237
  ```
348
238
 
349
- 生图能力和账号套餐有关:
350
-
351
- - `plus` 或更高套餐账号可正常调用 `images.generations` / `images.edits`
352
- - `free` 账号不支持生图,网关会直接返回明确错误,而不是继续请求上游
353
- - 管理页会显示当前账号的 `plan` 和“生图能力”状态
354
- - 当当前账号是 `free` 且你选中 `Images` 测试时,“发送请求”按钮会被直接禁用
355
-
356
- ### 6. 当前支持的接口
357
-
358
- - `GET /_gateway/health`
359
- - `GET /_gateway/status`
360
- - `GET /_gateway/models`
361
- - `POST /_gateway/models/refresh`
362
- - `GET /_gateway/admin/config`
363
- - `POST /_gateway/admin/login`
364
- - `POST /_gateway/admin/logout`
365
- - `POST /_gateway/admin/profiles/activate`
366
- - `POST /_gateway/admin/profiles/remove`
367
- - `PUT /_gateway/admin/settings`
368
- - `GET /v1/models`
369
- - `POST /v1/responses`
370
- - `POST /v1/chat/completions`
371
- - `POST /v1/images/generations`
372
- - `POST /v1/images/edits`
373
-
374
- ### 7. 当前支持的主要参数
375
-
376
- `POST /v1/responses` 当前主要支持:
377
-
378
- - `model`
379
- - `input`
380
- - `instructions`
381
- - `stream`
382
- - `tools`
383
- - `tool_choice`
384
- - `include`
385
- - `text`
386
- - `store`
387
- - `parallel_tool_calls`
388
- - `experimental_codex.body`
389
- - `experimental_codex.allow_unknown_model`
390
- - `experimental_codex.include_raw`
391
-
392
- `POST /v1/chat/completions` 当前主要支持:
393
-
394
- - `model`
395
- - `messages`
396
- - `tools`
397
- - `tool_choice`
398
- - `response_format`
399
- - `temperature`
400
- - `top_p`
401
- - `presence_penalty`
402
- - `frequency_penalty`
403
- - `metadata`
404
- - `stop`
405
- - `store`
406
- - `parallel_tool_calls`
407
-
408
- `POST /v1/images/generations` 当前主要支持:
409
-
410
- - `prompt`
411
- - `model`
412
- - `n`
413
- - `size`
414
- - `quality`
415
- - `background`
416
- - `output_format`
417
- - `output_compression`
418
- - `moderation`
419
- - `response_format`
420
- - `user`
421
-
422
- `POST /v1/images/edits` 当前主要支持 JSON 请求:
423
-
424
- - `prompt`
425
- - `images`
426
- - `image`
427
- - `model`
428
- - `n`
429
- - `size`
430
- - `quality`
431
- - `background`
432
- - `output_format`
433
- - `output_compression`
434
- - `moderation`
435
- - `response_format`
436
- - `user`
437
-
438
- 其中 `images` / `image` 支持 `image_url`,可以是 `https://...` URL、`data:image/...;base64,...`,或裸 base64 字符串。
439
-
440
- ### 8. 当前限制
441
-
442
- - `stream=true` 目前只识别,不返回真实流式结果
443
- - 还没有完整覆盖 OpenAI Responses API 的全部字段
444
- - `chat.completions` 暂不支持 `n > 1`
445
- - `images.generations` 暂不支持 `n > 1`
446
- - `images.generations` 当前只返回 `b64_json`,暂不支持托管图片 `url`
447
- - `images.generations` 当前只透传 GPT Image 路径,不兼容 DALL·E 专有参数
448
- - `images.edits` 当前只支持 `application/json`,暂不支持 `multipart/form-data`、`mask` 和 `file_id`
449
- - `images.generations` / `images.edits` 对账号套餐有要求;`free` 账号会被网关直接拦截并返回“不支持图片生成”
450
- - 网关当前默认面向本地单用户使用
451
-
452
- ## 兼容说明
453
-
454
- 代码里仍然保留了 `login`、`status`、`models`、`profiles`、`ask`、`serve`、`clear` 等 CLI 命令,主要用于调试、兼容和后续扩展。
455
-
456
- 账号 JSON 也可以通过 CLI 导入/导出:
239
+ Run from source:
457
240
 
458
241
  ```bash
459
- azt profiles import ./profile.json
460
- azt profiles export active ./profile.json
461
- azt profiles export all ./profiles.json
462
- azt profiles export "openai-codex:<accountId>" ./profile.json
242
+ bun src/cli.ts start
463
243
  ```
464
244
 
465
- README 不再把这些命令作为推荐使用方式。默认使用路径就是:
245
+ Validate:
466
246
 
467
247
  ```bash
468
- azt start
248
+ npm run typecheck
249
+ npm run build
469
250
  ```
470
251
 
471
- ## 交流与反馈
472
-
473
- 如果你在使用过程中遇到安装问题、账号切换问题、生图异常,或者想交流自己的接入场景,可以通过下面两种方式联系我:
474
-
475
- - GitHub Issues: [https://github.com/fchangjun/AI-Zero-Token/issues](https://github.com/fchangjun/AI-Zero-Token/issues)
476
- - 微信交流:先加我微信,备注 `AI Zero Token`,我会再拉你进交流群
477
-
478
- 如果你已经把二维码放到仓库里,可以直接查看:
479
-
480
- ![AI Zero Token 微信联系二维码](docs/images/wechat-contact.png)
481
-
482
- ## 本地状态
483
-
484
- 项目会在仓库目录下写入:
485
-
486
- - `.state/store.json`
487
- - `.state/settings.json`
488
-
489
- 它们分别用于保存:
252
+ CLI packaging and release notes are documented in [BUILD_CLI.md](BUILD_CLI.md). User-facing changes are tracked in [CHANGELOG.md](CHANGELOG.md).
490
253
 
491
- - OAuth 认证信息和多个本地账号 profile
492
- - 默认模型和服务配置
254
+ ## Project Status
493
255
 
494
- ## 项目结构
256
+ 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.
495
257
 
496
- - `src/cli/`
497
- CLI 命令解析和命令分发
498
- - `src/core/`
499
- 核心业务逻辑
500
- - `src/core/services/`
501
- 认证、模型、聊天、配置服务
502
- - `src/core/store/`
503
- 本地状态读写
504
- - `src/core/providers/openai-codex/`
505
- OpenAI Codex provider 实现
506
- - `src/server/`
507
- 本地 HTTP 网关
258
+ Issues and feature requests: [GitHub Issues](https://github.com/fchangjun/AI-Zero-Token/issues)