documentation: Update ocm/ccm examples
This commit is contained in:
@@ -66,7 +66,19 @@ List of authorized users for token authentication.
|
|||||||
|
|
||||||
If empty, no authentication is required.
|
If empty, no authentication is required.
|
||||||
|
|
||||||
Claude Code authenticates by setting the `ANTHROPIC_AUTH_TOKEN` environment variable to their token value.
|
Object format:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"token": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
#### headers
|
#### headers
|
||||||
|
|
||||||
@@ -84,23 +96,36 @@ TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
|||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
#### Server
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"type": "ccm",
|
"type": "ccm",
|
||||||
"listen": "127.0.0.1",
|
"listen": "0.0.0.0",
|
||||||
"listen_port": 8080
|
"listen_port": 8080,
|
||||||
|
"usages_path": "./claude-usages.json",
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"name": "alice",
|
||||||
|
"token": "ak-ccm-hello-world"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bob",
|
||||||
|
"token": "ak-ccm-hello-bob"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Connect to the CCM service:
|
#### Client
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
||||||
export ANTHROPIC_AUTH_TOKEN="sk-ant-ccm-auth-token-not-required-in-this-context"
|
export ANTHROPIC_AUTH_TOKEN="ak-ccm-hello-world"
|
||||||
|
|
||||||
claude
|
claude
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -66,7 +66,19 @@ Claude Code OAuth 凭据文件的路径。
|
|||||||
|
|
||||||
如果为空,则不需要身份验证。
|
如果为空,则不需要身份验证。
|
||||||
|
|
||||||
Claude Code 通过设置 `ANTHROPIC_AUTH_TOKEN` 环境变量为其令牌值进行身份验证。
|
对象格式:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"token": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
对象字段:
|
||||||
|
|
||||||
|
- `name`:用于跟踪的用户名标识符。
|
||||||
|
- `token`:用于身份验证的 Bearer 令牌。Claude Code 通过设置 `ANTHROPIC_AUTH_TOKEN` 环境变量为其令牌值进行身份验证。
|
||||||
|
|
||||||
#### headers
|
#### headers
|
||||||
|
|
||||||
@@ -84,23 +96,36 @@ TLS 配置,参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|||||||
|
|
||||||
### 示例
|
### 示例
|
||||||
|
|
||||||
|
#### 服务端
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"services": [
|
"services": [
|
||||||
{
|
{
|
||||||
"type": "ccm",
|
"type": "ccm",
|
||||||
"listen": "127.0.0.1",
|
"listen": "0.0.0.0",
|
||||||
"listen_port": 8080
|
"listen_port": 8080,
|
||||||
|
"usages_path": "./claude-usages.json",
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"name": "alice",
|
||||||
|
"token": "ak-ccm-hello-world"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bob",
|
||||||
|
"token": "ak-ccm-hello-bob"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
连接到 CCM 服务:
|
#### 客户端
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
||||||
export ANTHROPIC_AUTH_TOKEN="sk-ant-ccm-auth-token-not-required-in-this-context"
|
export ANTHROPIC_AUTH_TOKEN="ak-ccm-hello-world"
|
||||||
|
|
||||||
claude
|
claude
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ See [Listen Fields](/configuration/shared/listen/) for details.
|
|||||||
|
|
||||||
Path to the OpenAI OAuth credentials file.
|
Path to the OpenAI OAuth credentials file.
|
||||||
|
|
||||||
If not specified, defaults to `~/.codex/auth.json`.
|
If not specified, defaults to:
|
||||||
|
- `$CODEX_HOME/auth.json` if `CODEX_HOME` environment variable is set
|
||||||
|
- `~/.codex/auth.json` otherwise
|
||||||
|
|
||||||
Refreshed tokens are automatically written back to the same location.
|
Refreshed tokens are automatically written back to the same location.
|
||||||
|
|
||||||
@@ -111,6 +113,8 @@ TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
|||||||
Add to `~/.codex/config.toml`:
|
Add to `~/.codex/config.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
# profile = "ocm" # set as default profile
|
||||||
|
|
||||||
[model_providers.ocm]
|
[model_providers.ocm]
|
||||||
name = "OCM Proxy"
|
name = "OCM Proxy"
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
base_url = "http://127.0.0.1:8080/v1"
|
||||||
@@ -143,11 +147,11 @@ codex --profile ocm
|
|||||||
"users": [
|
"users": [
|
||||||
{
|
{
|
||||||
"name": "alice",
|
"name": "alice",
|
||||||
"token": "sk-alice-secret-token"
|
"token": "sk-ocm-hello-world"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bob",
|
"name": "bob",
|
||||||
"token": "sk-bob-secret-token"
|
"token": "sk-ocm-hello-bob"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -160,11 +164,13 @@ codex --profile ocm
|
|||||||
Add to `~/.codex/config.toml`:
|
Add to `~/.codex/config.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
# profile = "ocm" # set as default profile
|
||||||
|
|
||||||
[model_providers.ocm]
|
[model_providers.ocm]
|
||||||
name = "OCM Proxy"
|
name = "OCM Proxy"
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
base_url = "http://127.0.0.1:8080/v1"
|
||||||
supports_websockets = true
|
supports_websockets = true
|
||||||
experimental_bearer_token = "sk-alice-secret-token"
|
experimental_bearer_token = "sk-ocm-hello-world"
|
||||||
|
|
||||||
[profiles.ocm]
|
[profiles.ocm]
|
||||||
model_provider = "ocm"
|
model_provider = "ocm"
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ OCM(OpenAI Codex 多路复用器)服务是一个多路复用服务,允许
|
|||||||
|
|
||||||
OpenAI OAuth 凭据文件的路径。
|
OpenAI OAuth 凭据文件的路径。
|
||||||
|
|
||||||
如果未指定,默认值为 `~/.codex/auth.json`。
|
如果未指定,默认值为:
|
||||||
|
- 如果设置了 `CODEX_HOME` 环境变量,则使用 `$CODEX_HOME/auth.json`
|
||||||
|
- 否则使用 `~/.codex/auth.json`
|
||||||
|
|
||||||
刷新的令牌会自动写回相同位置。
|
刷新的令牌会自动写回相同位置。
|
||||||
|
|
||||||
@@ -111,6 +113,9 @@ TLS 配置,参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|||||||
在 `~/.codex/config.toml` 中添加:
|
在 `~/.codex/config.toml` 中添加:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
# profile = "ocm" # 设为默认配置
|
||||||
|
|
||||||
|
|
||||||
[model_providers.ocm]
|
[model_providers.ocm]
|
||||||
name = "OCM Proxy"
|
name = "OCM Proxy"
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
base_url = "http://127.0.0.1:8080/v1"
|
||||||
@@ -143,11 +148,11 @@ codex --profile ocm
|
|||||||
"users": [
|
"users": [
|
||||||
{
|
{
|
||||||
"name": "alice",
|
"name": "alice",
|
||||||
"token": "sk-alice-secret-token"
|
"token": "sk-ocm-hello-world"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bob",
|
"name": "bob",
|
||||||
"token": "sk-bob-secret-token"
|
"token": "sk-ocm-hello-bob"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -160,11 +165,13 @@ codex --profile ocm
|
|||||||
在 `~/.codex/config.toml` 中添加:
|
在 `~/.codex/config.toml` 中添加:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
# profile = "ocm" # 设为默认配置
|
||||||
|
|
||||||
[model_providers.ocm]
|
[model_providers.ocm]
|
||||||
name = "OCM Proxy"
|
name = "OCM Proxy"
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
base_url = "http://127.0.0.1:8080/v1"
|
||||||
supports_websockets = true
|
supports_websockets = true
|
||||||
experimental_bearer_token = "sk-alice-secret-token"
|
experimental_bearer_token = "sk-ocm-hello-world"
|
||||||
|
|
||||||
[profiles.ocm]
|
[profiles.ocm]
|
||||||
model_provider = "ocm"
|
model_provider = "ocm"
|
||||||
|
|||||||
Reference in New Issue
Block a user