|
1 | 1 | # Codex API Switchboard |
2 | 2 |
|
3 | | -Privacy-first static tool for rebuilding a complete Codex configuration TXT when switching custom API providers. |
| 3 | +默认语言:简体中文 | [English](README.en.md) |
4 | 4 |
|
5 | | -[Live demo](https://codex-config-txt.pages.dev) |
| 5 | +隐私优先的静态工具,用于在切换 Codex 自定义 API 站点时,生成完整的配置 TXT。 |
6 | 6 |
|
7 | | -## Purpose |
| 7 | +[在线演示](https://codex-config-txt.pages.dev) |
8 | 8 |
|
9 | | -Codex users who sign in with account credentials may still route model requests through a custom API provider. When switching API sites, replacing the whole configuration can accidentally drop plugin, conversation, feature, and profile settings. |
| 9 | + |
10 | 10 |
|
11 | | -Codex API Switchboard solves that narrow workflow: |
| 11 | +## 项目定位 |
12 | 12 |
|
13 | | -- import or paste a local `config.toml` |
14 | | -- replace only `base_url` and `experimental_bearer_token` |
15 | | -- automatically normalize `base_url` with a `/v1` suffix |
16 | | -- export a complete TXT while preserving the rest of the configuration |
17 | | -- mask the token in the visible output while copy/download still use the full generated content |
| 13 | +Codex 用户通过账号凭证登录后,仍可能把模型请求路由到自定义 API Provider。切换不同 API 站点时,如果直接替换整份配置,容易丢失插件、对话、功能开关、profiles 等已有设置。 |
18 | 14 |
|
19 | | -## Important Scope |
| 15 | +Codex API Switchboard 专注解决这个窄场景: |
20 | 16 |
|
21 | | -This tool is only for account credential login combined with custom API usage. |
| 17 | +- 导入、拖入或粘贴本地 `config.toml` |
| 18 | +- 只替换 `[model_providers.custom]` 下的 `base_url` 和 `experimental_bearer_token` |
| 19 | +- `base_url` 自动补齐 `/v1` |
| 20 | +- 输出完整 TXT,并保留其余 Codex 配置 |
| 21 | +- 页面可见输出默认遮罩 token,复制和下载仍使用当前会话生成的完整内容 |
22 | 22 |
|
23 | | -It is not a general Codex account-login replacement, and it does not create or validate API credentials. |
| 23 | +## 重要适用范围 |
24 | 24 |
|
25 | | -## Privacy Model |
| 25 | +仅适用于账号凭证登录 + 使用自定义 API 的情况。 |
26 | 26 |
|
27 | | -The page is a static browser-only utility. |
| 27 | +本工具不是 Codex 账号登录替代方案,也不会创建、校验或托管 API 凭证。 |
28 | 28 |
|
29 | | -- No upload. |
30 | | -- No storage. |
31 | | -- No cookies. |
32 | | -- No network requests from the page. |
33 | | -- No backend service. |
34 | | -- Cloudflare Pages CSP uses `connect-src 'none'`. |
| 29 | +## 隐私与安全模型 |
35 | 30 |
|
36 | | -All file reading and text replacement happens inside the current browser tab. |
| 31 | +这是一个纯静态、浏览器本地运行的工具。 |
37 | 32 |
|
38 | | -## Technical Tags |
| 33 | +- 不上传文件 |
| 34 | +- 不存储数据 |
| 35 | +- 不使用 Cookie |
| 36 | +- 页面不发起网络请求 |
| 37 | +- 没有后端服务 |
| 38 | +- Cloudflare Pages `_headers` 使用 `connect-src 'none'` |
39 | 39 |
|
40 | | -`Codex` `Cloudflare Pages` `Static HTML` `Vanilla JavaScript` `TOML` `Content Security Policy` `Privacy-first` `API routing` `Config tooling` |
| 40 | +文件读取、文本替换和 TXT 生成都发生在当前浏览器标签页内。 |
41 | 41 |
|
42 | | -## Tech Stack |
| 42 | +## 技术标签 |
43 | 43 |
|
44 | | -- HTML, CSS, and vanilla JavaScript |
45 | | -- Static deployment on Cloudflare Pages |
46 | | -- Strict CSP via `_headers` |
47 | | -- Local validation script with Node.js |
48 | | -- GitHub Actions validation workflow |
| 44 | +`Codex` `Cloudflare Pages` `Static HTML` `Vanilla JavaScript` `TOML` `Content Security Policy` `Privacy-first` `API Routing` `Config Tooling` |
49 | 45 |
|
50 | | -## Local Validation |
| 46 | +## 技术栈 |
| 47 | + |
| 48 | +- HTML、CSS、Vanilla JavaScript |
| 49 | +- Cloudflare Pages 静态部署 |
| 50 | +- `_headers` 配置严格 CSP |
| 51 | +- Node.js 本地公开产物校验 |
| 52 | +- GitHub Actions 自动验证 |
| 53 | + |
| 54 | +## 本地验证 |
51 | 55 |
|
52 | 56 | ```bash |
53 | 57 | npm run validate |
54 | 58 | ``` |
55 | 59 |
|
56 | | -The validation script checks: |
| 60 | +校验脚本会检查: |
57 | 61 |
|
58 | | -- inline JavaScript parses |
59 | | -- required scope warning remains visible |
60 | | -- `connect-src 'none'` remains in `_headers` |
61 | | -- no browser storage or network APIs are used |
62 | | -- no local machine paths, default provider URLs, or token-like secrets are present in the public page |
63 | | -- removed layout elements do not reappear |
| 62 | +- 内联 JavaScript 可解析 |
| 63 | +- 重要适用范围提示仍存在 |
| 64 | +- `_headers` 保留 `connect-src 'none'` |
| 65 | +- 未使用浏览器存储或联网 API |
| 66 | +- 公开页面不包含本机路径、默认 API 站点或 token-like secret |
| 67 | +- 已删除的旧布局元素不会重新出现 |
64 | 68 |
|
65 | | -## Deployment |
| 69 | +## 部署 |
66 | 70 |
|
67 | | -Deploy the repository root to Cloudflare Pages: |
| 71 | +将仓库根目录部署到 Cloudflare Pages: |
68 | 72 |
|
69 | 73 | ```bash |
70 | 74 | wrangler pages deploy . --project-name codex-config-txt |
71 | 75 | ``` |
72 | 76 |
|
73 | | -## License |
| 77 | +## 许可证 |
74 | 78 |
|
75 | 79 | MIT |
0 commit comments