Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ Qwen Cloud, Qoder Global and CN (official PAT + CLI), SiliconFlow, and more. Ful

```bash
ocx init # interactive setup (writes config, wires Codex, offers the shim)
ocx start [--port 10100] # start the proxy in the foreground
ocx start [--port 10100] [--socks5 [host:port] | --socks5-off] # SOCKS5 defaults to socks5://127.0.0.1:10808
ocx stop # stop + restore native Codex
ocx service [install|repair|restart|start|stop|status|uninstall|remove] # background service
ocx codex-shim install # start the proxy on demand whenever `codex` launches
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/fr/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ Assistant de configuration interactif (`setup` est un alias de `init`). Il deman

## Cycle de vie du proxy

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

Démarre le serveur proxy, de préférence sur le port `10100`. Si ce port est occupé, opencodex en choisit un autre qui est disponible et l’enregistre. La commande écrit l’état du PID et du port d’exécution, et refuse de démarrer une deuxième instance active. Au démarrage, elle synchronise dans le catalogue Codex les modèles de chaque fournisseur. À l’arrêt, elle rétablit le fonctionnement natif de Codex, sauf si le proxy a été lancé comme service géré (`OCX_SERVICE=1`).

```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exécute des fonctionnalités d'assistance autour des demandes du fournisseur.
| --- | --- | --- | --- |
| `port` | `number` | `10100` | Port d'écoute proxy. |
| `hostname?` | `string` | `"127.0.0.1"` | Adresse de liaison. Les liaisons hors bouclage nécessitent `OPENCODEX_API_AUTH_TOKEN`. |
| `proxy?` | `string` | — | URL du proxy HTTP(S) sortant ou `${ENV_VAR}`. Appliquée à `HTTP_PROXY` / `HTTPS_PROXY` uniquement lorsque ces variables ne sont pas définies ; le bouclage reste dans `NO_PROXY`. |
| `proxy?` | `string` | — | URL du proxy HTTP(S) ou SOCKS5 sortant (`socks5://host:port`, `ocx start --socks5`) ou `${ENV_VAR}`. Les URL HTTP s’appliquent à `HTTP_PROXY` / `HTTPS_PROXY` uniquement lorsque ces variables ne sont pas définies ; SOCKS5 est exposé via `ALL_PROXY` et le transport SOCKS5 d’OpenCodex. Le bouclage reste dans `NO_PROXY`. |
| `emptyCompletionRetry?` | `boolean` | `false` | Active une nouvelle tentative Responses identique lorsqu’une réponse ne contient ni texte ni appel d’outil. Cette tentative peut être facturée. `OCX_EMPTY_COMPLETION_RETRY=0` la désactive sans modifier la configuration ; les combinaisons et les tours de compactage routés restent exclus. |
| `stallTimeoutSec?` | `number` | `300` | Nombre de secondes sans données en amont avant `response.incomplete`. Minimum : 1. |
| `connectTimeoutMs?` | `number` | `200000` | Délai maximal par tentative pour DNS/TCP/TLS et les en-têtes finaux ; il prend fin avant la génération du corps. |
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/ja/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ description: セットアップ、開始、停止、サービス、診断、同

## プロキシのライフサイクル

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

プロキシ サーバー (優先ポート `10100`) を起動します。そのポートが占有されている場合、opencodex は別の使用可能なポートを選択して記録します。 PID/ランタイムポートの状態を書き込み、2 番目のライブインスタンスの起動を拒否します。開始時に、各プロバイダーのモデルを Codex のカタログに同期します。マネージド サービス (`OCX_SERVICE=1`) として起動されていない限り、シャットダウン時にネイティブ Codex が復元されます。

```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: リスナー、リモート アクセス、アドミッション
| --- | --- | --- | --- |
| `port` | `number` | `10100` |プロキシリッスンポート。 |
| `hostname?` | `string` | `"127.0.0.1"` |バインドアドレス。非ループバック バインドには `OPENCODEX_API_AUTH_TOKEN` が必要です。 |
| `proxy?` | `string` | — |送信 HTTP(S) プロキシ URL または `${ENV_VAR}`。これらの変数が設定されていない場合にのみ、`HTTP_PROXY` / `HTTPS_PROXY` に適用されます。ループバックは `NO_PROXY` に残ります。 |
| `proxy?` | `string` | — | 送信 HTTP(S) または SOCKS5 プロキシ URL(`socks5://host:port`、`ocx start --socks5`)または `${ENV_VAR}`。HTTP URL はこれらの変数が設定されていない場合にのみ `HTTP_PROXY` / `HTTPS_PROXY` に適用され、SOCKS5 は `ALL_PROXY` と OpenCodex の SOCKS5 転送を使います。ループバックは `NO_PROXY` に残ります。 |
| `emptyCompletionRetry?` | `boolean` | `false` | テキストもツール呼び出しもない Responses ターンを、ターミナルイベント前にストリームが終了した場合も含め、同一リクエストで 1 回再試行するよう明示的に有効化します。再試行は課金対象になる場合があります。`OCX_EMPTY_COMPLETION_RETRY=0` で設定を変更せず無効化できます。combo と routed-compaction turn は対象外です。 |
| `stallTimeoutSec?` | `number` | `300` | `response.incomplete` より前にアップストリーム データがない秒数。最小 1。
| `connectTimeoutMs?` | `number` | `200000` |試行ごとの DNS/TCP/TLS/最終ヘッダーの期限。本体が生成される前に終了します。 |
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/ko/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Codex 자동 시작 shim도 설치합니다.

## 프록시 수명 주기

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

프록시 서버를 시작합니다(권장 포트는 `10100`). 해당 포트가 이미 사용 중이면 opencodex가 다른
사용 가능한 포트를 골라 기록합니다. PID와 런타임 포트 상태를 기록하고, 두 번째 활성 인스턴스는 시작하지
Expand All @@ -26,6 +26,8 @@ Codex 자동 시작 shim도 설치합니다.
```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: 리스너, 원격 접근, admission 키, 타임아웃, 저장소,
| --- | --- | --- | --- |
| `port` | `number` | `10100` | 프록시 수신 포트입니다. |
| `hostname?` | `string` | `"127.0.0.1"` | 바인드 주소입니다. 루프백이 아닌 바인드에는 `OPENCODEX_API_AUTH_TOKEN`이 필요합니다. |
| `proxy?` | `string` | — | 송신용 HTTP(S) 프록시 URL 또는 `${ENV_VAR}`입니다. 해당 변수가 비어 있을 때만 `HTTP_PROXY` / `HTTPS_PROXY`에 적용되며, 루프백은 `NO_PROXY`에 그대로 남습니다. |
| `proxy?` | `string` | — | 송신용 HTTP(S) 또는 SOCKS5 프록시 URL(`socks5://host:port`, `ocx start --socks5`) 또는 `${ENV_VAR}`입니다. HTTP URL은 해당 변수가 비어 있을 때만 `HTTP_PROXY` / `HTTPS_PROXY`에 적용되며, SOCKS5는 `ALL_PROXY`와 OpenCodex SOCKS5 전송을 사용합니다. 루프백은 `NO_PROXY`에 그대로 남습니다. |
| `emptyCompletionRetry?` | `boolean` | `false` | 텍스트나 도구 호출이 없는 Responses 턴을, 터미널 이벤트 전에 스트림이 종료된 경우를 포함해 동일한 요청으로 한 번 재시도하도록 선택합니다. 재시도에는 비용이 발생할 수 있습니다. `OCX_EMPTY_COMPLETION_RETRY=0`은 설정을 바꾸지 않고 비활성화하며, combo 및 routed-compaction turn은 제외됩니다. |
| `stallTimeoutSec?` | `number` | `300` | 업스트림 데이터가 없을 때 `response.incomplete`가 되기까지의 초 수입니다. 최소 1입니다. |
| `connectTimeoutMs?` | `number` | `200000` | 시도별 DNS/TCP/TLS/최종 헤더 기한입니다. 본문 생성 전에 끝납니다. |
Expand Down
10 changes: 9 additions & 1 deletion docs-site/src/content/docs/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ optionally installs the Codex autostart shim.

## Proxy lifecycle

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

Start the proxy server (preferred port `10100`). If that port is occupied, opencodex selects and
records another available port. It writes PID/runtime-port state and refuses to start a second live
instance. On start it syncs each provider's models into Codex's catalog. On shutdown it restores
native Codex — unless it was launched as a managed service (`OCX_SERVICE=1`).

`--socks5` (default `127.0.0.1:10808`) saves `config.proxy` as a SOCKS5 URL and routes outbound
HTTP(S) through a real SOCKS5 tunnel. `--socks5-off` clears only that saved SOCKS5 proxy; it
does not remove an HTTP proxy. The value survives `ocx update` because it lives in config, not in
the installed package. A proxy username and password may be included in the URL, but startup
logs redact them.

```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
16 changes: 13 additions & 3 deletions docs-site/src/content/docs/reference/configuration/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs helper features around provider requests.
| --- | --- | --- | --- |
| `port` | `number` | `10100` | Proxy listen port. |
| `hostname?` | `string` | `"127.0.0.1"` | Bind address. Non-loopback binds require `OPENCODEX_API_AUTH_TOKEN`. |
| `proxy?` | `string` | — | Outbound HTTP(S) proxy URL, `${ENV_VAR}`, or `"auto"`. Applied to `HTTP_PROXY` / `HTTPS_PROXY` only when those variables are unset; loopback remains in `NO_PROXY`. `"auto"` reads the Windows system proxy (WinINET `ProxyEnable`/`ProxyServer`, `https=` then `http=` entry) once at process start and logs the host it chose. On other platforms, or when the system proxy is off, SOCKS-only, or unreadable, it uses direct egress and says so. PAC/WPAD and live proxy changes are not followed; restart the service after changing the system proxy. |
| `proxy?` | `string` | — | Outbound HTTP(S) or SOCKS5 proxy URL (`socks5://host:port`), `${ENV_VAR}`, or `"auto"`. HTTP URLs apply to `HTTP_PROXY` / `HTTPS_PROXY` when those are unset. SOCKS5 URLs use OpenCodex's real SOCKS5 transport and are also exposed through `ALL_PROXY` (`ocx start --socks5`); inherited `HTTP(S)_PROXY` is cleared in this process. Loopback stays in `NO_PROXY`. `"auto"` reads the Windows system proxy (WinINET `ProxyEnable`/`ProxyServer`, `https=` then `http=` entry) once at process start and logs the host it chose. On other platforms, or when the system proxy is off, SOCKS-only, or unreadable, it uses direct egress and says so. PAC/WPAD and live proxy changes are not followed; restart the service after changing the system proxy. |
| `noProxy?` | `string \| string[]` | — | Hosts that bypass `proxy`, merged with inherited `NO_PROXY` and loopback entries. A string may use comma-separated `NO_PROXY` syntax or `${ENV_VAR}`. |
| `emptyCompletionRetry?` | `boolean` | `false` | Opt in to one identical Responses retry when a turn has no text or tool call, including a stream that ends before a terminal event. The retry may be billable. `OCX_EMPTY_COMPLETION_RETRY=0` disables it without changing config; combo and routed-compaction turns remain excluded. |
| `stallTimeoutSec?` | `number` | `300` | Seconds without upstream data before `response.incomplete`. Minimum 1. |
Expand Down Expand Up @@ -45,6 +45,14 @@ replacing an inherited `NO_PROXY`:
{ "proxy": "http://proxy.corp:8080", "noProxy": ["internal.example", "10.0.0.0/8"] }
```

SOCKS5 (Clash mixed-port listeners included) belongs on `ALL_PROXY`, not `HTTP_PROXY`:

```jsonc
{ "proxy": "socks5://127.0.0.1:10808" }
```

`ocx start --socks5` writes that value; `ocx start --socks5-off` clears it.

If an older development build changed resume-history metadata before backup support existed, run
`ocx recover-history --legacy-openai --yes` to force native-provider recovery.
It force-relabels every user-message `opencodex` row, including legitimate dedicated-provider
Expand Down Expand Up @@ -91,10 +99,12 @@ terminal does not update an already running service.

An unset `proxy` leaves inherited proxy variables unchanged. An explicit HTTP(S)
proxy URL fills `HTTP_PROXY` and `HTTPS_PROXY` only where they are unset.
`"proxy": "auto"` reads the Windows static WinINET proxy once at startup; existing
An explicit SOCKS5 URL (`socks5://host:port`) is mirrored into `ALL_PROXY`,
clears inherited `HTTP(S)_PROXY` in this process, and uses OpenCodex's SOCKS5
transport. `"proxy": "auto"` reads the Windows static WinINET proxy once at startup; existing
proxy environment variables take precedence. Auto discovery does not resolve
PAC/WPAD, SOCKS-only settings or live proxy changes. Use a supported static HTTP
proxy setting or an explicit HTTP(S) proxy URL when needed.
proxy setting, an explicit HTTP(S) proxy URL, or `ocx start --socks5` when needed.

Compare the diagnostic on the same machine and account under the two network
modes. A successful TUN test alone does not identify why the service's HTTP proxy
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/ru/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ opencodex и его интеграцию с Codex.

## Жизненный цикл прокси

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

Запустить proxy server (предпочтительный порт `10100`). Если этот порт занят, opencodex выбирает и
записывает другой свободный порт. При запуске пишется состояние PID/runtime-port, а попытка
Expand All @@ -29,6 +29,8 @@ opencodex и его интеграцию с Codex.
```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: Listener, удалённый доступ, admission key, тайм
| --- | --- | --- | --- |
| `port` | `number` | `10100` | Порт, который слушает прокси. |
| `hostname?` | `string` | `"127.0.0.1"` | Адрес bind'а. Не-loopback bind требует `OPENCODEX_API_AUTH_TOKEN`. |
| `proxy?` | `string` | — | URL исходящего HTTP(S)-прокси или `${ENV_VAR}`. Применяется к `HTTP_PROXY` / `HTTPS_PROXY` только когда эти переменные не заданы; loopback всегда остаётся в `NO_PROXY`. |
| `proxy?` | `string` | — | URL исходящего HTTP(S) или SOCKS5-прокси (`socks5://host:port`, `ocx start --socks5`) или `${ENV_VAR}`. HTTP URL применяется к `HTTP_PROXY` / `HTTPS_PROXY` только когда эти переменные не заданы; SOCKS5 пишется в `ALL_PROXY` и использует транспорт SOCKS5 OpenCodex. loopback всегда остаётся в `NO_PROXY`. |
| `emptyCompletionRetry?` | `boolean` | `false` | Явно включает один идентичный повтор Responses, если в turn нет ни текста, ни tool call, включая случай, когда stream завершается до terminal event. Повтор может тарифицироваться. `OCX_EMPTY_COMPLETION_RETRY=0` отключает его без изменения config; combo и routed-compaction turn исключены. |
| `stallTimeoutSec?` | `number` | `300` | Секунды без upstream-данных до `response.incomplete`. Минимум 1. |
| `connectTimeoutMs?` | `number` | `200000` | Дедлайн одной попытки DNS/TCP/TLS/final-header; он завершается до генерации тела ответа. |
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/tr/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ otomatik başlatma dolgusunu kurar.

## Proxy yaşam döngüsü

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

Proxy sunucusunu başlatın (tercih edilen port `10100`). Bu port doluysa
opencodex başka bir kullanılabilir port seçer ve kaydeder. PID/çalışma zamanı
Expand All @@ -31,6 +31,8 @@ Codex'i geri yükler.
```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ yardımcı özellikleri nasıl çalıştıracağını kontrol eder.
| --- | --- | --- | --- |
| `port` | `number` | `10100` | Proxy dinleme portu. |
| `hostname?` | `string` | `"127.0.0.1"` | Bağlama adresi. Geri döngü olmayan bağlamalar `OPENCODEX_API_AUTH_TOKEN` gerektirir. |
| `proxy?` | `string` | — | Giden HTTP(S) proxy URL'si veya `${ENV_VAR}`. Yalnızca bu değişkenler ayarlanmadığında `HTTP_PROXY` / `HTTPS_PROXY`'ye uygulanır; geri döngü `NO_PROXY` içinde kalır. |
| `proxy?` | `string` | — | Giden HTTP(S) veya SOCKS5 proxy URL'si (`socks5://host:port`, `ocx start --socks5`) veya `${ENV_VAR}`. HTTP URL'leri yalnızca bu değişkenler ayarlanmadığında `HTTP_PROXY` / `HTTPS_PROXY`'ye uygulanır; SOCKS5 `ALL_PROXY` ve OpenCodex SOCKS5 aktarımını kullanır. Geri döngü `NO_PROXY` içinde kalır. |
| `emptyCompletionRetry?` | `boolean` | `false` | Metin veya araç çağrısı içermeyen bir Responses tamamlamasını aynı istekle bir kez yeniden denemeyi açıkça etkinleştirir. Yeniden deneme ücretlendirilebilir. `OCX_EMPTY_COMPLETION_RETRY=0`, yapılandırmayı değiştirmeden devre dışı bırakır; combo ve routed-compaction turları hariçtir. |
| `stallTimeoutSec?` | `number` | `300` | `response.incomplete` öncesinde yukarı akış verisi olmadan geçen saniye. Minimum 1. |
| `connectTimeoutMs?` | `number` | `200000` | Deneme başına DNS/TCP/TLS/nihai başlık son tarihi; gövde üretiminden önce biter. |
Expand Down
4 changes: 3 additions & 1 deletion docs-site/src/content/docs/zh-cn/reference/cli/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ description: 安装、启动、停止、服务、诊断、同步和更新命令

## 代理生命周期

### `ocx start [--port <port>]`
### `ocx start [--port <port>] [--socks5 [host:port] | --socks5-off]`

启动代理服务器(首选端口 `10100`)。如果该端口已被占用,opencodex 会选择并记录另一个可用端口。它会写入 PID/运行时端口状态,并拒绝启动第二个存活实例。启动时,它会把每个提供方的模型同步到 Codex 的目录中。关闭时,它会恢复原生 Codex,除非它是作为受管服务启动的(`OCX_SERVICE=1`)。

```bash
ocx start
ocx start --port 8080
ocx start --port 10100 --socks5
ocx start --socks5-off
```

### `ocx stop`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description: 监听、远程访问、准入密钥、超时、存储、侧车、
| --- | --- | --- | --- |
| `port` | `number` | `10100` | 代理监听端口。 |
| `hostname?` | `string` | `"127.0.0.1"` | 绑定地址。非回环绑定需要 `OPENCODEX_API_AUTH_TOKEN`。 |
| `proxy?` | `string` | — | 出站 HTTP(S) 代理 URL或 `${ENV_VAR}`。仅当 `HTTP_PROXY` / `HTTPS_PROXY` 未设置时才会应用;回环地址始终保留在 `NO_PROXY` 中。 |
| `proxy?` | `string` | — | 出站 HTTP(S) 或 SOCKS5 代理 URL(`socks5://host:port`,`ocx start --socks5`),或 `${ENV_VAR}`。HTTP URL 仅当 `HTTP_PROXY` / `HTTPS_PROXY` 未设置时才会应用;SOCKS5 写入 `ALL_PROXY` 并使用 OpenCodex SOCKS5 传输。回环地址始终保留在 `NO_PROXY` 中。 |
| `emptyCompletionRetry?` | `boolean` | `false` | 显式启用:当 Responses turn 既无文本也无工具调用时,使用相同请求重试一次,包括流在终止事件之前结束的情况。重试可能产生费用。`OCX_EMPTY_COMPLETION_RETRY=0` 可在不修改配置的情况下禁用;combo 与 routed-compaction turn 不参与。 |
| `stallTimeoutSec?` | `number` | `300` | 在上游没有数据之前可等待的秒数,超过后返回 `response.incomplete`。最小值为 1。 |
| `connectTimeoutMs?` | `number` | `200000` | 每次尝试的 DNS/TCP/TLS/最终响应头截止时间;它在正文生成之前结束。 |
Expand Down
Loading
Loading