From 488334979518421ebbf982778d8377d7e46845be Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Fri, 31 Oct 2025 15:22:09 +0800 Subject: [PATCH] Update doc --- MANAGEMENT_API.md | 6 ++++-- MANAGEMENT_API_CN.md | 4 +++- README.md | 10 +++------- README_CN.md | 10 +++------- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/MANAGEMENT_API.md b/MANAGEMENT_API.md index 676027b4..a2e3988b 100644 --- a/MANAGEMENT_API.md +++ b/MANAGEMENT_API.md @@ -95,7 +95,7 @@ If a plaintext key is detected in the config at startup, it will be bcrypt‑has ``` - Response: ```json - {"debug":true,"proxy-url":"","api-keys":["1...5","JS...W"],"quota-exceeded":{"switch-project":true,"switch-preview-model":true},"gemini-api-key":[{"api-key":"AI...01","base-url":"https://generativelanguage.googleapis.com","headers":{"X-Custom-Header":"custom-value"},"proxy-url":""},{"api-key":"AI...02","proxy-url":"socks5://proxy.example.com:1080"}],"generative-language-api-key":["AI...01","AI...02","AI...03"],"request-log":true,"request-retry":3,"claude-api-key":[{"api-key":"cr...56","base-url":"https://example.com/api","proxy-url":"socks5://proxy.example.com:1080","models":[{"name":"claude-3-5-sonnet-20241022","alias":"claude-sonnet-latest"}]},{"api-key":"cr...e3","base-url":"http://example.com:3000/api","proxy-url":""},{"api-key":"sk-...q2","base-url":"https://example.com","proxy-url":""}],"codex-api-key":[{"api-key":"sk...01","base-url":"https://example/v1","proxy-url":""}],"openai-compatibility":[{"name":"openrouter","base-url":"https://openrouter.ai/api/v1","api-key-entries":[{"api-key":"sk...01","proxy-url":""}],"models":[{"name":"moonshotai/kimi-k2:free","alias":"kimi-k2"}]},{"name":"iflow","base-url":"https://apis.iflow.cn/v1","api-key-entries":[{"api-key":"sk...7e","proxy-url":"socks5://proxy.example.com:1080"}],"models":[{"name":"deepseek-v3.1","alias":"deepseek-v3.1"},{"name":"glm-4.5","alias":"glm-4.5"},{"name":"kimi-k2","alias":"kimi-k2"}]}]} + {"debug":true,"proxy-url":"","api-keys":["1...5","JS...W"],"quota-exceeded":{"switch-project":true,"switch-preview-model":true},"gemini-api-key":[{"api-key":"AI...01","base-url":"https://generativelanguage.googleapis.com","headers":{"X-Custom-Header":"custom-value"},"proxy-url":""},{"api-key":"AI...02","proxy-url":"socks5://proxy.example.com:1080"}],"request-log":true,"request-retry":3,"claude-api-key":[{"api-key":"cr...56","base-url":"https://example.com/api","proxy-url":"socks5://proxy.example.com:1080","models":[{"name":"claude-3-5-sonnet-20241022","alias":"claude-sonnet-latest"}]},{"api-key":"cr...e3","base-url":"http://example.com:3000/api","proxy-url":""},{"api-key":"sk-...q2","base-url":"https://example.com","proxy-url":""}],"codex-api-key":[{"api-key":"sk...01","base-url":"https://example/v1","proxy-url":""}],"openai-compatibility":[{"name":"openrouter","base-url":"https://openrouter.ai/api/v1","api-key-entries":[{"api-key":"sk...01","proxy-url":""}],"models":[{"name":"moonshotai/kimi-k2:free","alias":"kimi-k2"}]},{"name":"iflow","base-url":"https://apis.iflow.cn/v1","api-key-entries":[{"api-key":"sk...7e","proxy-url":"socks5://proxy.example.com:1080"}],"models":[{"name":"deepseek-v3.1","alias":"deepseek-v3.1"},{"name":"glm-4.5","alias":"glm-4.5"},{"name":"kimi-k2","alias":"kimi-k2"}]}]} ``` ### Debug @@ -345,7 +345,7 @@ These endpoints update the inline `config-api-key` provider inside the `auth.pro { "status": "ok" } ``` -### Generative Language API Key (Legacy) +### Generative Language API Key (Legacy Alias) - GET `/generative-language-api-key` - Request: ```bash @@ -388,6 +388,8 @@ These endpoints update the inline `config-api-key` provider inside the `auth.pro ```json { "status": "ok" } ``` +- Notes: + - This endpoint mirrors the key-only view of `gemini-api-key`. ### Codex API KEY (object array) - GET `/codex-api-key` — List all diff --git a/MANAGEMENT_API_CN.md b/MANAGEMENT_API_CN.md index fe1d3f17..f352993e 100644 --- a/MANAGEMENT_API_CN.md +++ b/MANAGEMENT_API_CN.md @@ -95,7 +95,7 @@ ``` - 响应: ```json - {"debug":true,"proxy-url":"","api-keys":["1...5","JS...W"],"quota-exceeded":{"switch-project":true,"switch-preview-model":true},"gemini-api-key":[{"api-key":"AI...01","base-url":"https://generativelanguage.googleapis.com","headers":{"X-Custom-Header":"custom-value"},"proxy-url":""},{"api-key":"AI...02","proxy-url":"socks5://proxy.example.com:1080"}],"generative-language-api-key":["AI...01","AI...02","AI...03"],"request-log":true,"request-retry":3,"claude-api-key":[{"api-key":"cr...56","base-url":"https://example.com/api","proxy-url":"socks5://proxy.example.com:1080","models":[{"name":"claude-3-5-sonnet-20241022","alias":"claude-sonnet-latest"}]},{"api-key":"cr...e3","base-url":"http://example.com:3000/api","proxy-url":""},{"api-key":"sk-...q2","base-url":"https://example.com","proxy-url":""}],"codex-api-key":[{"api-key":"sk...01","base-url":"https://example/v1","proxy-url":""}],"openai-compatibility":[{"name":"openrouter","base-url":"https://openrouter.ai/api/v1","api-key-entries":[{"api-key":"sk...01","proxy-url":""}],"models":[{"name":"moonshotai/kimi-k2:free","alias":"kimi-k2"}]},{"name":"iflow","base-url":"https://apis.iflow.cn/v1","api-key-entries":[{"api-key":"sk...7e","proxy-url":"socks5://proxy.example.com:1080"}],"models":[{"name":"deepseek-v3.1","alias":"deepseek-v3.1"},{"name":"glm-4.5","alias":"glm-4.5"},{"name":"kimi-k2","alias":"kimi-k2"}]}]} + {"debug":true,"proxy-url":"","api-keys":["1...5","JS...W"],"quota-exceeded":{"switch-project":true,"switch-preview-model":true},"gemini-api-key":[{"api-key":"AI...01","base-url":"https://generativelanguage.googleapis.com","headers":{"X-Custom-Header":"custom-value"},"proxy-url":""},{"api-key":"AI...02","proxy-url":"socks5://proxy.example.com:1080"}],"request-log":true,"request-retry":3,"claude-api-key":[{"api-key":"cr...56","base-url":"https://example.com/api","proxy-url":"socks5://proxy.example.com:1080","models":[{"name":"claude-3-5-sonnet-20241022","alias":"claude-sonnet-latest"}]},{"api-key":"cr...e3","base-url":"http://example.com:3000/api","proxy-url":""},{"api-key":"sk-...q2","base-url":"https://example.com","proxy-url":""}],"codex-api-key":[{"api-key":"sk...01","base-url":"https://example/v1","proxy-url":""}],"openai-compatibility":[{"name":"openrouter","base-url":"https://openrouter.ai/api/v1","api-key-entries":[{"api-key":"sk...01","proxy-url":""}],"models":[{"name":"moonshotai/kimi-k2:free","alias":"kimi-k2"}]},{"name":"iflow","base-url":"https://apis.iflow.cn/v1","api-key-entries":[{"api-key":"sk...7e","proxy-url":"socks5://proxy.example.com:1080"}],"models":[{"name":"deepseek-v3.1","alias":"deepseek-v3.1"},{"name":"glm-4.5","alias":"glm-4.5"},{"name":"kimi-k2","alias":"kimi-k2"}]}]} ``` ### Debug @@ -388,6 +388,8 @@ ```json { "status": "ok" } ``` +- 说明: + - 该接口只读写纯字符串列表,实际上会映射到 `gemini-api-key`。 ### Codex API KEY(对象数组) - GET `/codex-api-key` — 列出全部 diff --git a/README.md b/README.md index 6ed7928d..b1270d72 100644 --- a/README.md +++ b/README.md @@ -326,7 +326,7 @@ The server uses a YAML configuration file (`config.yaml`) located in the project | `gemini-api-key.*.base-url` | string | "" | Optional Gemini API endpoint override. | | `gemini-api-key.*.headers` | object | {} | Optional extra HTTP headers sent to the overridden Gemini endpoint only. | | `gemini-api-key.*.proxy-url` | string | "" | Optional per-key proxy override for the Gemini API key. | -| `generative-language-api-key` | string[] | [] | (Legacy) List of Generative Language API keys without per-key overrides. | +| `generative-language-api-key` | string[] | [] | (Legacy alias) View-only list mirrored from `gemini-api-key`. Writes through the legacy management endpoint update the underlying Gemini entries. | | `codex-api-key` | object | {} | List of Codex API keys. | | `codex-api-key.api-key` | string | "" | Codex API key. | | `codex-api-key.base-url` | string | "" | Custom Codex API endpoint, if you use a third-party API endpoint. | @@ -399,7 +399,7 @@ quota-exceeded: switch-project: true # Whether to automatically switch to another project when a quota is exceeded switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded -# Gemini API keys (preferred) +# Gemini API keys gemini-api-key: - api-key: "AIzaSy...01" base-url: "https://generativelanguage.googleapis.com" @@ -408,10 +408,6 @@ gemini-api-key: proxy-url: "socks5://proxy.example.com:1080" - api-key: "AIzaSy...02" -# API keys for official Generative Language API (legacy compatibility) -generative-language-api-key: - - "AIzaSy...01" - # Codex API keys codex-api-key: - api-key: "sk-atSM..." @@ -571,7 +567,7 @@ The `auth-dir` parameter specifies where authentication tokens are stored. When ### Gemini API Configuration -Use the `gemini-api-key` parameter to configure Gemini API keys. Each entry accepts optional `base-url`, `headers`, and `proxy-url` values; headers are only attached to requests sent to the overridden Gemini endpoint and are never forwarded to proxy servers. When `base-url` is omitted the server behaves the same as the legacy `generative-language-api-key` list. The legacy array remains supported for backwards compatibility and is automatically mirrored into the new structure. +Use the `gemini-api-key` parameter to configure Gemini API keys. Each entry accepts optional `base-url`, `headers`, and `proxy-url` values; headers are only attached to requests sent to the overridden Gemini endpoint and are never forwarded to proxy servers. The legacy `generative-language-api-key` endpoint exposes a mirrored, key-only view for backwards compatibility—writes through that endpoint update the Gemini list but drop any per-key overrides, and the legacy field is no longer persisted in `config.yaml`. ## Hot Reloading diff --git a/README_CN.md b/README_CN.md index 5e2d9628..97000d53 100644 --- a/README_CN.md +++ b/README_CN.md @@ -339,7 +339,7 @@ console.log(await claudeResponse.json()); | `gemini-api-key.*.base-url` | string | "" | 可选的 Gemini API 端点覆盖地址。 | | `gemini-api-key.*.headers` | object | {} | 可选的额外 HTTP 头部,仅在访问覆盖后的 Gemini 端点时发送。 | | `gemini-api-key.*.proxy-url` | string | "" | 可选的单独代理设置,会覆盖全局 `proxy-url`。 | -| `generative-language-api-key` | string[] | [] | (兼容项)不带扩展配置的生成式语言 API 密钥列表。 | +| `generative-language-api-key` | string[] | [] | (兼容别名)旧管理接口返回的纯密钥列表。通过该接口写入会更新 `gemini-api-key`。 | | `codex-api-key` | object | {} | Codex API密钥列表。 | | `codex-api-key.api-key` | string | "" | Codex API密钥。 | | `codex-api-key.base-url` | string | "" | 自定义的Codex API端点 | @@ -412,7 +412,7 @@ quota-exceeded: switch-project: true # 当配额超限时是否自动切换到另一个项目 switch-preview-model: true # 当配额超限时是否自动切换到预览模型 -# Gemini API 密钥(推荐) +# Gemini API 密钥 gemini-api-key: - api-key: "AIzaSy...01" base-url: "https://generativelanguage.googleapis.com" @@ -421,10 +421,6 @@ gemini-api-key: proxy-url: "socks5://proxy.example.com:1080" - api-key: "AIzaSy...02" -# AIStudio Gemini API 的遗留密钥配置 -generative-language-api-key: - - "AIzaSy...01" - # Codex API 密钥 codex-api-key: - api-key: "sk-atSM..." @@ -582,7 +578,7 @@ openai-compatibility: ### Gemini API 配置 -使用 `gemini-api-key` 参数来配置 Gemini API 密钥;每个条目都可以选择性地提供 `base-url`、`headers` 与 `proxy-url`。`headers` 仅会附加到访问覆盖后 Gemini 端点的请求,不会转发给代理服务器。当 `base-url` 留空时,其行为与遗留的 `generative-language-api-key` 列表一致。旧字段仍受支持,会自动同步到新的结构中以保持兼容性。 +使用 `gemini-api-key` 参数来配置 Gemini API 密钥;每个条目都可以选择性地提供 `base-url`、`headers` 与 `proxy-url`。`headers` 仅会附加到访问覆盖后 Gemini 端点的请求,不会转发给代理服务器。旧的 `generative-language-api-key` 管理接口仍提供纯密钥视图以保持兼容——通过该接口写入会替换整个 Gemini 列表,并丢弃任何额外配置,同时该字段不再持久化到 `config.yaml`。 ## 热更新