Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0089283
fix(claude): carry typed web_search/web_fetch to an Anthropic target …
vadymhimself Oct 16, 2026
4170d67
fix(claude): relay Anthropic's server-side web_fetch results to the C…
vadymhimself Oct 16, 2026
a32d311
fix(claude): replay Anthropic server-tool exchanges on the translated…
vadymhimself Oct 16, 2026
038f89e
fix(claude): keep the caller's 1h cache TTL on the translated lane (c…
vadymhimself Oct 16, 2026
9365c26
fix(claude): surface a declared client refusal as its 4xx, not a retr…
vadymhimself Oct 16, 2026
6c352c9
fix(claude): keep the caller's max_tokens cap on non-canonical Respon…
vadymhimself Oct 16, 2026
d27c017
fix(web-search): meter every sidecar iteration in the usage ledger, n…
vadymhimself Oct 16, 2026
8720674
fix(loops): meter the usage an adapter error terminal carries (carry …
vadymhimself Oct 16, 2026
8801385
fix(sidecars): bill pre-rotation loop usage to the account that spent…
vadymhimself Oct 16, 2026
b21b6cf
fix(usage): no confident price for partly measured usage (carry #7189)
vadymhimself Oct 16, 2026
8c3619c
fix(usage): a retried request totals every physical attempt, not only…
vadymhimself Oct 16, 2026
febde6b
fix(service): wait out the evicted launchd job before repair bootstra…
vadymhimself Oct 16, 2026
965123f
fix(claude): exclude replay carry with ambiguous history anchors
lidge-jun Oct 16, 2026
8e80260
fix(usage): keep partly measured attempts unpriced and reconcile carr…
lidge-jun Oct 16, 2026
77dbc1d
fix(usage): scope unknown cost to unmeasured sends and fit structure …
lidge-jun Oct 16, 2026
27bb955
test(claude): move gateway output-cap regression below the size thres…
lidge-jun Oct 16, 2026
6b1d458
Merge origin/dev into codex/prr-vb; verify refusal usage accounting
lidge-jun Oct 16, 2026
c9c7601
test(images): count physical retry sends in refusal usage fixture
lidge-jun Oct 16, 2026
87cea2f
Merge origin/dev into #7225 for landing
lidge-jun Oct 16, 2026
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 docs-site/src/content/docs/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ The proxy translates every Anthropic Messages API request into the Codex Respons
| User `tool_result` | `function_call_output` (`is_error` → `[tool error]` prefix) |
| `tool_reference` in a tool result | Text `Tool loaded: <tool_name>` in the paired result; preserves loaded-tool names without adding declarations or enabling translated server-side deferral |
| `thinking` / `redacted_thinking` replay | `reasoning` items with bounded `ocxr1` envelopes for signatures and redacted payloads |
| Function tools | `{type: "function"}` (`web_search*` → `{type: "web_search"}`) |
| Function tools | `{type: "function"}` (`web_search*` → `{type: "web_search"}`). On a route to `api.anthropic.com`, the typed `web_search_*` and `web_fetch_*` declarations are also sent to Anthropic as declared and run server-side, unless the web-search sidecar supplies `web_search` itself. Each search or fetch comes back to the client as its `server_tool_use` block and its `web_search_tool_result` or `web_fetch_tool_result` |
| `tool_choice` | `auto`→`auto`, `none`→`none`, `any`→`required`, named function→`{type:"function",name}`, hosted WebSearch/web_search→`{type:"web_search"}` |
| `max_tokens` | `max_output_tokens` |
| `stop_sequences` | `stop` |
Expand Down
6 changes: 5 additions & 1 deletion docs-site/src/content/docs/guides/web-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ The **Usage** summary and Models/Providers tables show end-to-end output through

The **Usage** Models and Providers tables show the estimated priced portion for each row. Requests
without a matching price or usable usage are counted as excluded beside that amount when the proxy
reports pricing coverage fields. A row with only excluded requests shows an em dash with that count
reports pricing coverage fields. Usage that was only partly measured (`unreported` or `unsupported`)
is not priced, and one excluded part excludes the whole request from that row's priced count. A
leg that reached no upstream, or that upstream refused with an HTTP error before any output, spent
nothing and does not; a leg whose response began (or ended without a status) but reported no usage
may have been billed, so it does. A row with only excluded requests shows an em dash with that count
instead of a zero-dollar estimate, and a displayed zero-dollar value is a confirmed priced estimate.
An older proxy that reports no coverage fields keeps a bare em dash with no count, so missing
coverage stays distinct from an all-excluded row and from a confirmed zero estimate.
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/ja/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Messages → Responses に変換されるリクエストでは、Claude Code の
| Assistant `tool_use` | `function_call`(`input` → JSON 文字列に変換した `arguments`) |
| ユーザー `tool_result` | `function_call_output`(`is_error` → `[tool error]` 接頭辞) |
| `thinking` / `redacted_thinking` 再生 | シグネチャと秘匿ペイロードを境界付き `ocxr1` エンベロープに保持した `reasoning` 項目 |
| Function ツール | `{type: "function"}`(`web_search*` → `{type: "web_search"}`) |
| Function ツール | `{type: "function"}`(`web_search*` → `{type: "web_search"}`). `api.anthropic.com` への翻訳ルートでは、型付き `web_search_*` と `web_fetch_*` 宣言も Anthropic に送信され、サーバー側で実行されます。ただし Web 検索サイドカーが `web_search` を提供する場合はそちらが優先されます。検索と取得の結果は `server_tool_use` と対応する `web_search_tool_result` / `web_fetch_tool_result` としてクライアントに返されます |
| `tool_choice` | `auto`→`auto`、`none`→`none`、`any`→`required`、名前指定関数→`{type:"function",name}`、ホスト型 WebSearch/web_search→`{type:"web_search"}` |
| `max_tokens` | `max_output_tokens` |
| `stop_sequences` | `stop` |
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/ko/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ Messages → Responses로 변환되는 요청에서는 Claude Code의 `/effort`
| 사용자 `tool_result` | `function_call_output`(`is_error` → `[tool error]` 접두사) |
| 도구 결과의 `tool_reference` | 짝지어진 결과에 `Tool loaded: <tool_name>` 텍스트로 보존합니다. 도구 선언을 추가하거나 번역 경로의 서버 측 지연 로딩을 활성화하지는 않습니다. |
| `thinking` / `redacted_thinking` 재생 | 서명과 비공개 페이로드를 제한된 `ocxr1` 봉투에 담은 `reasoning` 항목 |
| Function 도구 | `{type: "function"}`(`web_search*` → `{type: "web_search"}`) |
| Function 도구 | `{type: "function"}`(`web_search*` → `{type: "web_search"}`). `api.anthropic.com`으로 번역하여 보내는 경로에서는 타입이 지정된 `web_search_*`와 `web_fetch_*` 선언도 Anthropic에 전달되어 서버에서 실행됩니다. 웹 검색 사이드카가 `web_search`를 제공하면 사이드카가 우선합니다. 검색과 가져오기 결과는 `server_tool_use` 및 대응하는 `web_search_tool_result` / `web_fetch_tool_result` 블록으로 클라이언트에 반환됩니다 |
| `tool_choice` | `auto`→`auto`, `none`→`none`, `any`→`required`, 이름 지정 함수→`{type:"function",name}`, 호스팅 WebSearch/web_search→`{type:"web_search"}` |
| `max_tokens` | `max_output_tokens` |
| `stop_sequences` | `stop` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ separate. Full request URLs such as `/api/v1/responses` are not provider base UR
| `maxUpstreamBodyBytes?` | `number` | `0` | Opt-in ceiling, in bytes, on a serialized native Responses **passthrough** body. `0` or omitted disables it — no limit is inferred for any destination. When set, a built body above the ceiling is refused locally before the send: streaming turns receive a terminal `response.failed` / `context_length_exceeded` so the client compacts instead of resending, and non-streaming turns receive a `413` naming the size, the number of embedded `input_image` items, and roughly how many megabytes of image data they represent. Checked at every build and rebuild point, including OAuth-refresh replay and alternate-account retry. Translated adapter paths are not covered. There is deliberately no default: the only measured ceiling here belongs to the WebSocket transport, which already falls back to HTTP for oversized turns, so a default would refuse requests that currently succeed. Set it when your gateway has a known request-size limit and you would rather see an actionable local error than an opaque upstream failure. |
| `maxInboundBodyBytes?` | `number` | `0` | Opt-in ceiling, in bytes, on a decompressed **inbound** data-plane request body — the mirror of `maxUpstreamBodyBytes` above. `0` or omitted keeps the built-in 256 MiB default. Raise it when a large-context session can no longer compact: Codex replays the whole history to the compaction model, so on the 922k-token opt-in window the compaction request is itself the one that crosses the limit, and the session is stuck at the only operation that would have shrunk it. Clamped to 1 MiB–512 MiB. The ceiling is not negotiable: the reader materializes the body several times over (wire bytes, decoded bytes, the decoded string, and the parsed object graph), so peak memory is a multiple of whatever is admitted, and an unbounded value would be a memory exhaustion lever. Applies to `/v1/responses`, `/v1/responses/compact`, `/v1/chat/completions`, and `/v1/messages`. The listener's accept size is fixed when the proxy binds, so a change takes effect on restart. A body above the limit is refused locally with HTTP 413 and `code: "inbound_body_too_large"`, which is deliberately distinct from the `context_length_exceeded` 413 a provider size refusal produces. |
| `modelCacheTtlMs?` | `number` | `300000` | Freshness window for the per-provider `/models` cache. |
| `cacheRetention?` | `"none" \| "short" \| "long"` | `"short"` | Anthropic prompt-cache policy: disabled, 5-minute ephemeral, or 1-hour extended. |
| `cacheRetention?` | `"none" \| "short" \| "long"` | `"short"` | Anthropic prompt-cache policy: disabled, 5-minute ephemeral, or 1-hour extended. When unset, a `/v1/messages` request on a translated route whose own `cache_control` breakpoints all ask for `ttl: "1h"` is treated as `"long"`; a request that mixes 1h and 5m breakpoints keeps the 5-minute default, and an explicit value always wins. |
| `tokenGuardian?` | `OcxTokenGuardianConfig` | off | Optional proactive OAuth refresh and Codex-account warmup policy. |

Across these strategies, each account's effective threshold is its `codexAccountAutoSwitchThresholds` entry when present, otherwise global `autoSwitchThreshold`. A zero override disables only proactive usage switching; startup binding, hard-lock, cooldown, entitlement checks, and failure recovery remain enforced.
Expand Down
9 changes: 5 additions & 4 deletions docs-site/src/content/docs/reference/management-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,11 @@ upstream model evidence remains absent rather than being inferred from the reque

Failed request rows can include bounded `upstreamErrorType`, `upstreamErrorCode`, and
`upstreamRequestId` diagnostics. On the Codex upstream WebSocket path, a bare error followed by
EOF retains recognized rate-limit or overload codes in the synthesized failed terminal.
Request logs record these as 429 for `rate_limit_exceeded` / `rate_limit_error`, or 503 for
`server_is_overloaded` / `overloaded_error`. A recognized type without a code uses the same
status. On the streaming path, an explicit unknown code records the 5xx status the Codex
EOF retains recognized rate-limit, overload, or client-refusal codes in the synthesized failed terminal.
Request logs record these as 429 for `rate_limit_exceeded` / `rate_limit_error`, 503 for
`server_is_overloaded` / `overloaded_error`, and 400/401/403/404 for `invalid_request_error` /
`authentication_error` / `permission_error` / `not_found_error`. A recognized type without a code
uses the same status. On the streaming path, an explicit unknown code records the 5xx status the Codex
WebSocket wrapper states as a top-level integer `status` or `status_code` (one of the two, not
both); otherwise, and for buffered JSON callers, it remains a generic 502 failure. The client
terminal keeps `upstream_server_error` for unknown codes either way. Bare-error status is provisional:
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/ru/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ Claude Code — это лишь учётные данные для доступ
| `tool_use` ассистента | `function_call` (`input` → `arguments` в виде JSON-строки) |
| `tool_result` пользователя | `function_call_output` (`is_error` → префикс `[tool error]`) |
| Повтор `thinking` / `redacted_thinking` | Элементы `reasoning` с ограниченными конвертами `ocxr1` для подписей и скрытых данных |
| Function-инструменты | `{type: "function"}` (`web_search*` → `{type: "web_search"}`) |
| Function-инструменты | `{type: "function"}` (`web_search*` → `{type: "web_search"}`). На переведённом маршруте к `api.anthropic.com` типизированные объявления `web_search_*` и `web_fetch_*` также передаются Anthropic для выполнения на сервере, если только сайдкар веб-поиска сам не предоставляет `web_search`. Поиск и загрузка возвращаются клиенту как `server_tool_use` и соответствующий `web_search_tool_result` / `web_fetch_tool_result` |
| `tool_choice` | `auto`→`auto`, `none`→`none`, `any`→`required`, именованная функция→`{type:"function",name}`, размещённый WebSearch/web_search→`{type:"web_search"}` |
| `max_tokens` | `max_output_tokens` |
| `stop_sequences` | `stop` |
Expand Down
2 changes: 1 addition & 1 deletion docs-site/src/content/docs/zh-cn/guides/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ Search 和图像描述沿用仓库已有的 Claude Code OAuth fingerprint 先例
| Assistant `tool_use` | `function_call`(`input` → JSON 字符串化的 `arguments`) |
| 用户 `tool_result` | `function_call_output`(`is_error` → `[tool error]` 前缀) |
| 重放 `thinking` / `redacted_thinking` | `reasoning` 项;签名和脱敏载荷保存在有界 `ocxr1` 信封中 |
| Function 工具 | `{type: "function"}`(`web_search*` → `{type: "web_search"}`) |
| Function 工具 | `{type: "function"}`(`web_search*` → `{type: "web_search"}`). 在到 `api.anthropic.com` 的转换路由上,带类型的 `web_search_*` 和 `web_fetch_*` 声明也会发送到 Anthropic 并在服务端执行;如果网页搜索边车提供了 `web_search`,则优先使用边车。搜索和抓取结果以 `server_tool_use` 及对应的 `web_search_tool_result` / `web_fetch_tool_result` 块返回客户端 |
| `tool_choice` | `auto`→`auto`,`none`→`none`,`any`→`required`,指定函数→`{type:"function",name}`,托管 WebSearch/web_search→`{type:"web_search"}` |
| `max_tokens` | `max_output_tokens` |
| `stop_sequences` | `stop` |
Expand Down
8 changes: 8 additions & 0 deletions scripts/test-layout/layout.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
"owner-registry-acl.test.ts": "config",
"minimax-combo-image-input.test.ts": "providers",
"web-search-forced-declaration.test.ts": "web-search",
"usage-partly-measured-cost.test.ts": "usage",
"claude-gateway-output-cap.test.ts": "claude-integration",
"claude-client-refusal-status.test.ts": "claude-integration",
"claude-translated-cache-ttl.test.ts": "claude-integration",
"claude-translated-server-tools.test.ts": "claude-integration",
"web-search-loop-iteration-usage.test.ts": "web-search",
"web-search-loop-error-usage.test.ts": "web-search",
"web-search-rotation-usage-attribution.test.ts": "web-search",
"claude-devin-output-order.test.ts": "claude-integration",
"codex-config-preservation.test.ts": "codex-integration",
"codex-credits.test.ts": "codex-integration",
Expand Down
Loading
Loading