mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-13 20:28:32 +10:00
docs: complete ccm/ocm documentation for 1.14.0 features
This commit is contained in:
@@ -13,7 +13,10 @@ It handles OAuth authentication with Claude's API on your local machine while al
|
||||
!!! quote "Changes in sing-box 1.14.0"
|
||||
|
||||
:material-plus: [credentials](#credentials)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [credential_path](#credential_path)
|
||||
:material-alert: [usages_path](#usages_path)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [detour](#detour)
|
||||
|
||||
### Structure
|
||||
|
||||
@@ -51,6 +54,8 @@ On macOS, credentials are read from the system keychain first, then fall back to
|
||||
|
||||
Refreshed tokens are automatically written back to the same location.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
When `credential_path` points to a file, the service can start before the file exists. The credential becomes available automatically after the file is created or updated, and becomes unavailable immediately if the file is later removed or becomes invalid.
|
||||
|
||||
On macOS without an explicit `credential_path`, keychain changes are not watched. Automatic reload only applies to the credential file path.
|
||||
@@ -65,7 +70,7 @@ List of credential configurations for multi-credential mode.
|
||||
|
||||
When set, top-level `credential_path`, `usages_path`, and `detour` are forbidden. Each user must specify a `credential` tag.
|
||||
|
||||
Each credential has a `type` field (`default`, `balancer`, or `fallback`) and a required `tag` field.
|
||||
Each credential has a `type` field (`default`, `external`, `balancer`, or `fallback`) and a required `tag` field.
|
||||
|
||||
##### Default Credential
|
||||
|
||||
@@ -76,7 +81,9 @@ Each credential has a `type` field (`default`, `balancer`, or `fallback`) and a
|
||||
"usages_path": "/path/to/usages.json",
|
||||
"detour": "",
|
||||
"reserve_5h": 20,
|
||||
"reserve_weekly": 20
|
||||
"reserve_weekly": 20,
|
||||
"limit_5h": 0,
|
||||
"limit_weekly": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,8 +92,10 @@ A single OAuth credential file. The `type` field can be omitted (defaults to `de
|
||||
- `credential_path`: Path to the credentials file. Same defaults as top-level `credential_path`.
|
||||
- `usages_path`: Optional usage tracking file for this credential.
|
||||
- `detour`: Outbound tag for connecting to the Claude API with this credential.
|
||||
- `reserve_5h`: Reserve threshold (1-99) for 5-hour window. Credential pauses at (100-N)% utilization.
|
||||
- `reserve_weekly`: Reserve threshold (1-99) for weekly window. Credential pauses at (100-N)% utilization.
|
||||
- `reserve_5h`: Reserve threshold (1-99) for 5-hour window. Credential pauses at (100-N)% utilization. Conflict with `limit_5h`.
|
||||
- `reserve_weekly`: Reserve threshold (1-99) for weekly window. Credential pauses at (100-N)% utilization. Conflict with `limit_weekly`.
|
||||
- `limit_5h`: Explicit utilization cap (1-99) for 5-hour window. Credential pauses when utilization reaches this value. Conflict with `reserve_5h`.
|
||||
- `limit_weekly`: Explicit utilization cap (1-99) for weekly window. Credential pauses when utilization reaches this value. Conflict with `reserve_weekly`.
|
||||
|
||||
##### Balancer Credential
|
||||
|
||||
@@ -122,6 +131,34 @@ Uses credentials in order. Falls through to the next when the current one is exh
|
||||
- `credentials`: ==Required== Ordered list of default credential tags.
|
||||
- `poll_interval`: How often to poll upstream usage API. Default `60s`.
|
||||
|
||||
##### External Credential
|
||||
|
||||
```json
|
||||
{
|
||||
"tag": "remote",
|
||||
"type": "external",
|
||||
"url": "",
|
||||
"server": "",
|
||||
"server_port": 0,
|
||||
"token": "",
|
||||
"reverse": false,
|
||||
"detour": "",
|
||||
"usages_path": "",
|
||||
"poll_interval": "30m"
|
||||
}
|
||||
```
|
||||
|
||||
Proxies requests through a remote CCM instance instead of using a local OAuth credential.
|
||||
|
||||
- `url`: URL of the remote CCM instance. Omit in reverse receiver mode.
|
||||
- `server`: Override server address for dialing, separate from URL hostname.
|
||||
- `server_port`: Override server port for dialing.
|
||||
- `token`: ==Required== Authentication token for the remote instance.
|
||||
- `reverse`: Enable reverse proxy mode. When `url` is set with `reverse`, acts as a connector that dials out to the remote instance. When `url` is empty, acts as a receiver waiting for inbound reverse connections.
|
||||
- `detour`: Outbound tag for connecting to the remote instance.
|
||||
- `usages_path`: Optional usage tracking file.
|
||||
- `poll_interval`: How often to poll the remote status endpoint. Default `30m`.
|
||||
|
||||
#### usages_path
|
||||
|
||||
Path to the file for storing aggregated API usage statistics.
|
||||
@@ -137,6 +174,8 @@ Statistics are organized by model, context window (200k standard vs 1M premium),
|
||||
|
||||
The statistics file is automatically saved every minute and upon service shutdown.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
Conflict with `credentials`. In multi-credential mode, use `usages_path` on individual default credentials.
|
||||
|
||||
#### users
|
||||
@@ -151,7 +190,9 @@ Object format:
|
||||
{
|
||||
"name": "",
|
||||
"token": "",
|
||||
"credential": ""
|
||||
"credential": "",
|
||||
"external_credential": "",
|
||||
"allow_external_usage": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -159,7 +200,12 @@ Object fields:
|
||||
|
||||
- `name`: Username identifier for tracking purposes.
|
||||
- `token`: Bearer token for authentication. Claude Code authenticates by setting the `ANTHROPIC_AUTH_TOKEN` environment variable to their token value.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
- `credential`: Credential tag to use for this user. ==Required== when `credentials` is set.
|
||||
- `external_credential`: Tag of an external credential dedicated to serving this user. Response rate-limit headers are rewritten with aggregated utilization from all other credentials available to this user.
|
||||
- `allow_external_usage`: Allow this user to use external credentials. `false` by default.
|
||||
|
||||
#### headers
|
||||
|
||||
@@ -171,6 +217,8 @@ These headers will override any existing headers with the same name.
|
||||
|
||||
Outbound tag for connecting to the Claude API.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
Conflict with `credentials`. In multi-credential mode, use `detour` on individual default credentials.
|
||||
|
||||
#### tls
|
||||
|
||||
@@ -13,7 +13,10 @@ CCM(Claude Code 多路复用器)服务是一个多路复用服务,允许
|
||||
!!! quote "sing-box 1.14.0 中的更改"
|
||||
|
||||
:material-plus: [credentials](#credentials)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [credential_path](#credential_path)
|
||||
:material-alert: [usages_path](#usages_path)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [detour](#detour)
|
||||
|
||||
### 结构
|
||||
|
||||
@@ -51,6 +54,8 @@ Claude Code OAuth 凭据文件的路径。
|
||||
|
||||
刷新的令牌会自动写回相同位置。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
当 `credential_path` 指向文件时,即使文件尚不存在,服务也可以启动。文件被创建或更新后,凭据会自动变为可用;如果文件之后被删除或变为无效,该凭据会立即变为不可用。
|
||||
|
||||
在 macOS 上如果未显式设置 `credential_path`,不会监听钥匙串变化。自动重载只作用于凭据文件路径。
|
||||
@@ -65,7 +70,7 @@ Claude Code OAuth 凭据文件的路径。
|
||||
|
||||
设置后,顶层 `credential_path`、`usages_path` 和 `detour` 被禁止。每个用户必须指定 `credential` 标签。
|
||||
|
||||
每个凭据有一个 `type` 字段(`default`、`balancer` 或 `fallback`)和一个必填的 `tag` 字段。
|
||||
每个凭据有一个 `type` 字段(`default`、`external`、`balancer` 或 `fallback`)和一个必填的 `tag` 字段。
|
||||
|
||||
##### 默认凭据
|
||||
|
||||
@@ -76,7 +81,9 @@ Claude Code OAuth 凭据文件的路径。
|
||||
"usages_path": "/path/to/usages.json",
|
||||
"detour": "",
|
||||
"reserve_5h": 20,
|
||||
"reserve_weekly": 20
|
||||
"reserve_weekly": 20,
|
||||
"limit_5h": 0,
|
||||
"limit_weekly": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -85,8 +92,10 @@ Claude Code OAuth 凭据文件的路径。
|
||||
- `credential_path`:凭据文件的路径。默认值与顶层 `credential_path` 相同。
|
||||
- `usages_path`:此凭据的可选使用跟踪文件。
|
||||
- `detour`:此凭据用于连接 Claude API 的出站标签。
|
||||
- `reserve_5h`:5 小时窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。
|
||||
- `reserve_weekly`:每周窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。
|
||||
- `reserve_5h`:5 小时窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。与 `limit_5h` 冲突。
|
||||
- `reserve_weekly`:每周窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。与 `limit_weekly` 冲突。
|
||||
- `limit_5h`:5 小时窗口的显式利用率上限(1-99)。凭据在利用率达到此值时暂停。与 `reserve_5h` 冲突。
|
||||
- `limit_weekly`:每周窗口的显式利用率上限(1-99)。凭据在利用率达到此值时暂停。与 `reserve_weekly` 冲突。
|
||||
|
||||
##### 均衡凭据
|
||||
|
||||
@@ -122,6 +131,34 @@ Claude Code OAuth 凭据文件的路径。
|
||||
- `credentials`:==必填== 有序的默认凭据标签列表。
|
||||
- `poll_interval`:轮询上游使用 API 的间隔。默认 `60s`。
|
||||
|
||||
##### 外部凭据
|
||||
|
||||
```json
|
||||
{
|
||||
"tag": "remote",
|
||||
"type": "external",
|
||||
"url": "",
|
||||
"server": "",
|
||||
"server_port": 0,
|
||||
"token": "",
|
||||
"reverse": false,
|
||||
"detour": "",
|
||||
"usages_path": "",
|
||||
"poll_interval": "30m"
|
||||
}
|
||||
```
|
||||
|
||||
通过远程 CCM 实例代理请求,而非使用本地 OAuth 凭据。
|
||||
|
||||
- `url`:远程 CCM 实例的 URL。在反向接收模式下省略。
|
||||
- `server`:覆盖拨号的服务器地址,与 URL 主机名分开。
|
||||
- `server_port`:覆盖拨号的服务器端口。
|
||||
- `token`:==必填== 远程实例的身份验证令牌。
|
||||
- `reverse`:启用反向代理模式。当设置了 `url` 和 `reverse` 时,作为连接器主动拨出到远程实例。当 `url` 为空时,作为接收器等待入站反向连接。
|
||||
- `detour`:用于连接远程实例的出站标签。
|
||||
- `usages_path`:可选的使用跟踪文件。
|
||||
- `poll_interval`:轮询远程状态端点的间隔。默认 `30m`。
|
||||
|
||||
#### usages_path
|
||||
|
||||
用于存储聚合 API 使用统计信息的文件路径。
|
||||
@@ -137,6 +174,8 @@ Claude Code OAuth 凭据文件的路径。
|
||||
|
||||
统计文件每分钟自动保存一次,并在服务关闭时保存。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
与 `credentials` 冲突。在多凭据模式下,在各个默认凭据上使用 `usages_path`。
|
||||
|
||||
#### users
|
||||
@@ -151,7 +190,9 @@ Claude Code OAuth 凭据文件的路径。
|
||||
{
|
||||
"name": "",
|
||||
"token": "",
|
||||
"credential": ""
|
||||
"credential": "",
|
||||
"external_credential": "",
|
||||
"allow_external_usage": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -159,7 +200,12 @@ Claude Code OAuth 凭据文件的路径。
|
||||
|
||||
- `name`:用于跟踪的用户名标识符。
|
||||
- `token`:用于身份验证的 Bearer 令牌。Claude Code 通过设置 `ANTHROPIC_AUTH_TOKEN` 环境变量为其令牌值进行身份验证。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
- `credential`:此用户使用的凭据标签。设置 `credentials` 时==必填==。
|
||||
- `external_credential`:专用于为此用户提供服务的外部凭据标签。响应的速率限制头会被重写为来自此用户所有其他可用凭据的聚合利用率。
|
||||
- `allow_external_usage`:允许此用户使用外部凭据。默认为 `false`。
|
||||
|
||||
#### headers
|
||||
|
||||
@@ -171,6 +217,8 @@ Claude Code OAuth 凭据文件的路径。
|
||||
|
||||
用于连接 Claude API 的出站标签。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
与 `credentials` 冲突。在多凭据模式下,在各个默认凭据上使用 `detour`。
|
||||
|
||||
#### tls
|
||||
|
||||
@@ -13,7 +13,10 @@ It handles OAuth authentication with OpenAI's API on your local machine while al
|
||||
!!! quote "Changes in sing-box 1.14.0"
|
||||
|
||||
:material-plus: [credentials](#credentials)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [credential_path](#credential_path)
|
||||
:material-alert: [usages_path](#usages_path)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [detour](#detour)
|
||||
|
||||
### Structure
|
||||
|
||||
@@ -49,6 +52,8 @@ If not specified, defaults to:
|
||||
|
||||
Refreshed tokens are automatically written back to the same location.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
When `credential_path` points to a file, the service can start before the file exists. The credential becomes available automatically after the file is created or updated, and becomes unavailable immediately if the file is later removed or becomes invalid.
|
||||
|
||||
Conflict with `credentials`.
|
||||
@@ -61,7 +66,7 @@ List of credential configurations for multi-credential mode.
|
||||
|
||||
When set, top-level `credential_path`, `usages_path`, and `detour` are forbidden. Each user must specify a `credential` tag.
|
||||
|
||||
Each credential has a `type` field (`default`, `balancer`, or `fallback`) and a required `tag` field.
|
||||
Each credential has a `type` field (`default`, `external`, `balancer`, or `fallback`) and a required `tag` field.
|
||||
|
||||
##### Default Credential
|
||||
|
||||
@@ -72,7 +77,9 @@ Each credential has a `type` field (`default`, `balancer`, or `fallback`) and a
|
||||
"usages_path": "/path/to/usages.json",
|
||||
"detour": "",
|
||||
"reserve_5h": 20,
|
||||
"reserve_weekly": 20
|
||||
"reserve_weekly": 20,
|
||||
"limit_5h": 0,
|
||||
"limit_weekly": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -81,8 +88,10 @@ A single OAuth credential file. The `type` field can be omitted (defaults to `de
|
||||
- `credential_path`: Path to the credentials file. Same defaults as top-level `credential_path`.
|
||||
- `usages_path`: Optional usage tracking file for this credential.
|
||||
- `detour`: Outbound tag for connecting to the OpenAI API with this credential.
|
||||
- `reserve_5h`: Reserve threshold (1-99) for primary rate limit window. Credential pauses at (100-N)% utilization.
|
||||
- `reserve_weekly`: Reserve threshold (1-99) for secondary (weekly) rate limit window. Credential pauses at (100-N)% utilization.
|
||||
- `reserve_5h`: Reserve threshold (1-99) for primary rate limit window. Credential pauses at (100-N)% utilization. Conflict with `limit_5h`.
|
||||
- `reserve_weekly`: Reserve threshold (1-99) for secondary (weekly) rate limit window. Credential pauses at (100-N)% utilization. Conflict with `limit_weekly`.
|
||||
- `limit_5h`: Explicit utilization cap (1-99) for primary rate limit window. Credential pauses when utilization reaches this value. Conflict with `reserve_5h`.
|
||||
- `limit_weekly`: Explicit utilization cap (1-99) for secondary (weekly) rate limit window. Credential pauses when utilization reaches this value. Conflict with `reserve_weekly`.
|
||||
|
||||
##### Balancer Credential
|
||||
|
||||
@@ -118,6 +127,34 @@ Uses credentials in order. Falls through to the next when the current one is exh
|
||||
- `credentials`: ==Required== Ordered list of default credential tags.
|
||||
- `poll_interval`: How often to poll upstream usage API. Default `60s`.
|
||||
|
||||
##### External Credential
|
||||
|
||||
```json
|
||||
{
|
||||
"tag": "remote",
|
||||
"type": "external",
|
||||
"url": "",
|
||||
"server": "",
|
||||
"server_port": 0,
|
||||
"token": "",
|
||||
"reverse": false,
|
||||
"detour": "",
|
||||
"usages_path": "",
|
||||
"poll_interval": "30m"
|
||||
}
|
||||
```
|
||||
|
||||
Proxies requests through a remote OCM instance instead of using a local OAuth credential.
|
||||
|
||||
- `url`: URL of the remote OCM instance. Omit in reverse receiver mode.
|
||||
- `server`: Override server address for dialing, separate from URL hostname.
|
||||
- `server_port`: Override server port for dialing.
|
||||
- `token`: ==Required== Authentication token for the remote instance.
|
||||
- `reverse`: Enable reverse proxy mode. When `url` is set with `reverse`, acts as a connector that dials out to the remote instance. When `url` is empty, acts as a receiver waiting for inbound reverse connections.
|
||||
- `detour`: Outbound tag for connecting to the remote instance.
|
||||
- `usages_path`: Optional usage tracking file.
|
||||
- `poll_interval`: How often to poll the remote status endpoint. Default `30m`.
|
||||
|
||||
#### usages_path
|
||||
|
||||
Path to the file for storing aggregated API usage statistics.
|
||||
@@ -133,6 +170,8 @@ Statistics are organized by model and optionally by user when authentication is
|
||||
|
||||
The statistics file is automatically saved every minute and upon service shutdown.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
Conflict with `credentials`. In multi-credential mode, use `usages_path` on individual default credentials.
|
||||
|
||||
#### users
|
||||
@@ -147,7 +186,9 @@ Object format:
|
||||
{
|
||||
"name": "",
|
||||
"token": "",
|
||||
"credential": ""
|
||||
"credential": "",
|
||||
"external_credential": "",
|
||||
"allow_external_usage": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -155,7 +196,12 @@ Object fields:
|
||||
|
||||
- `name`: Username identifier for tracking purposes.
|
||||
- `token`: Bearer token for authentication. Clients authenticate by setting the `Authorization: Bearer <token>` header.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
- `credential`: Credential tag to use for this user. ==Required== when `credentials` is set.
|
||||
- `external_credential`: Tag of an external credential dedicated to serving this user. Response rate-limit headers are rewritten with aggregated utilization from all other credentials available to this user.
|
||||
- `allow_external_usage`: Allow this user to use external credentials. `false` by default.
|
||||
|
||||
#### headers
|
||||
|
||||
@@ -167,6 +213,8 @@ These headers will override any existing headers with the same name.
|
||||
|
||||
Outbound tag for connecting to the OpenAI API.
|
||||
|
||||
!!! question "Since sing-box 1.14.0"
|
||||
|
||||
Conflict with `credentials`. In multi-credential mode, use `detour` on individual default credentials.
|
||||
|
||||
#### tls
|
||||
|
||||
@@ -13,7 +13,10 @@ OCM(OpenAI Codex 多路复用器)服务是一个多路复用服务,允许
|
||||
!!! quote "sing-box 1.14.0 中的更改"
|
||||
|
||||
:material-plus: [credentials](#credentials)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [credential_path](#credential_path)
|
||||
:material-alert: [usages_path](#usages_path)
|
||||
:material-alert: [users](#users)
|
||||
:material-alert: [detour](#detour)
|
||||
|
||||
### 结构
|
||||
|
||||
@@ -49,6 +52,8 @@ OpenAI OAuth 凭据文件的路径。
|
||||
|
||||
刷新的令牌会自动写回相同位置。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
当 `credential_path` 指向文件时,即使文件尚不存在,服务也可以启动。文件被创建或更新后,凭据会自动变为可用;如果文件之后被删除或变为无效,该凭据会立即变为不可用。
|
||||
|
||||
与 `credentials` 冲突。
|
||||
@@ -61,7 +66,7 @@ OpenAI OAuth 凭据文件的路径。
|
||||
|
||||
设置后,顶层 `credential_path`、`usages_path` 和 `detour` 被禁止。每个用户必须指定 `credential` 标签。
|
||||
|
||||
每个凭据有一个 `type` 字段(`default`、`balancer` 或 `fallback`)和一个必填的 `tag` 字段。
|
||||
每个凭据有一个 `type` 字段(`default`、`external`、`balancer` 或 `fallback`)和一个必填的 `tag` 字段。
|
||||
|
||||
##### 默认凭据
|
||||
|
||||
@@ -72,7 +77,9 @@ OpenAI OAuth 凭据文件的路径。
|
||||
"usages_path": "/path/to/usages.json",
|
||||
"detour": "",
|
||||
"reserve_5h": 20,
|
||||
"reserve_weekly": 20
|
||||
"reserve_weekly": 20,
|
||||
"limit_5h": 0,
|
||||
"limit_weekly": 0
|
||||
}
|
||||
```
|
||||
|
||||
@@ -81,8 +88,10 @@ OpenAI OAuth 凭据文件的路径。
|
||||
- `credential_path`:凭据文件的路径。默认值与顶层 `credential_path` 相同。
|
||||
- `usages_path`:此凭据的可选使用跟踪文件。
|
||||
- `detour`:此凭据用于连接 OpenAI API 的出站标签。
|
||||
- `reserve_5h`:主要速率限制窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。
|
||||
- `reserve_weekly`:次要(每周)速率限制窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。
|
||||
- `reserve_5h`:主要速率限制窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。与 `limit_5h` 冲突。
|
||||
- `reserve_weekly`:次要(每周)速率限制窗口的保留阈值(1-99)。凭据在利用率达到 (100-N)% 时暂停。与 `limit_weekly` 冲突。
|
||||
- `limit_5h`:主要速率限制窗口的显式利用率上限(1-99)。凭据在利用率达到此值时暂停。与 `reserve_5h` 冲突。
|
||||
- `limit_weekly`:次要(每周)速率限制窗口的显式利用率上限(1-99)。凭据在利用率达到此值时暂停。与 `reserve_weekly` 冲突。
|
||||
|
||||
##### 均衡凭据
|
||||
|
||||
@@ -118,6 +127,34 @@ OpenAI OAuth 凭据文件的路径。
|
||||
- `credentials`:==必填== 有序的默认凭据标签列表。
|
||||
- `poll_interval`:轮询上游使用 API 的间隔。默认 `60s`。
|
||||
|
||||
##### 外部凭据
|
||||
|
||||
```json
|
||||
{
|
||||
"tag": "remote",
|
||||
"type": "external",
|
||||
"url": "",
|
||||
"server": "",
|
||||
"server_port": 0,
|
||||
"token": "",
|
||||
"reverse": false,
|
||||
"detour": "",
|
||||
"usages_path": "",
|
||||
"poll_interval": "30m"
|
||||
}
|
||||
```
|
||||
|
||||
通过远程 OCM 实例代理请求,而非使用本地 OAuth 凭据。
|
||||
|
||||
- `url`:远程 OCM 实例的 URL。在反向接收模式下省略。
|
||||
- `server`:覆盖拨号的服务器地址,与 URL 主机名分开。
|
||||
- `server_port`:覆盖拨号的服务器端口。
|
||||
- `token`:==必填== 远程实例的身份验证令牌。
|
||||
- `reverse`:启用反向代理模式。当设置了 `url` 和 `reverse` 时,作为连接器主动拨出到远程实例。当 `url` 为空时,作为接收器等待入站反向连接。
|
||||
- `detour`:用于连接远程实例的出站标签。
|
||||
- `usages_path`:可选的使用跟踪文件。
|
||||
- `poll_interval`:轮询远程状态端点的间隔。默认 `30m`。
|
||||
|
||||
#### usages_path
|
||||
|
||||
用于存储聚合 API 使用统计信息的文件路径。
|
||||
@@ -133,6 +170,8 @@ OpenAI OAuth 凭据文件的路径。
|
||||
|
||||
统计文件每分钟自动保存一次,并在服务关闭时保存。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
与 `credentials` 冲突。在多凭据模式下,在各个默认凭据上使用 `usages_path`。
|
||||
|
||||
#### users
|
||||
@@ -147,7 +186,9 @@ OpenAI OAuth 凭据文件的路径。
|
||||
{
|
||||
"name": "",
|
||||
"token": "",
|
||||
"credential": ""
|
||||
"credential": "",
|
||||
"external_credential": "",
|
||||
"allow_external_usage": false
|
||||
}
|
||||
```
|
||||
|
||||
@@ -155,7 +196,12 @@ OpenAI OAuth 凭据文件的路径。
|
||||
|
||||
- `name`:用于跟踪的用户名标识符。
|
||||
- `token`:用于身份验证的 Bearer 令牌。客户端通过设置 `Authorization: Bearer <token>` 头进行身份验证。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
- `credential`:此用户使用的凭据标签。设置 `credentials` 时==必填==。
|
||||
- `external_credential`:专用于为此用户提供服务的外部凭据标签。响应的速率限制头会被重写为来自此用户所有其他可用凭据的聚合利用率。
|
||||
- `allow_external_usage`:允许此用户使用外部凭据。默认为 `false`。
|
||||
|
||||
#### headers
|
||||
|
||||
@@ -167,6 +213,8 @@ OpenAI OAuth 凭据文件的路径。
|
||||
|
||||
用于连接 OpenAI API 的出站标签。
|
||||
|
||||
!!! question "自 sing-box 1.14.0 起"
|
||||
|
||||
与 `credentials` 冲突。在多凭据模式下,在各个默认凭据上使用 `detour`。
|
||||
|
||||
#### tls
|
||||
|
||||
Reference in New Issue
Block a user