Skip to content
Merged
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
8 changes: 5 additions & 3 deletions docs/streaming-discovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ this relationship.
- A fallback that has produced a valid prefix is held until the current normal
window closes, all normal candidates fail, or no candidates remain. A normal
winner always has precedence during the window.
- Discovery losers are cancelled and their readers/agents/provider-session
references are released. They do not enter legacy `bill_hedge_losers`
draining.
- When `bill_hedge_losers` is enabled, a Discovery loser that already produced
a protocol-valid prefix and reached ready state may reuse the legacy
background drain and billing path. It is billed only after natural stream
completion with a completion marker and explicit usage. All other losers are
cancelled and their readers/agents/provider-session references are released.
- Sticky binding is written only after a natural, successful stream completion
with the protocol completion marker and a generation-aware CAS. Fake-200,
incomplete, and client-aborted streams do not create or renew Sticky.
Expand Down
12 changes: 6 additions & 6 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,12 @@
"breakpoints": true
},
{
"idx": 109,
"version": "7",
"when": 1784067387303,
"tag": "0109_nice_shriek",
"breakpoints": true
},
"idx": 109,
"version": "7",
"when": 1784067387303,
"tag": "0109_nice_shriek",
"breakpoints": true
},
{
"idx": 110,
"version": "7",
Expand Down
8 changes: 7 additions & 1 deletion messages/en/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"title": "Billing Details",
"input": "Input",
"output": "Output",
"cacheWrite": "Cache Write",
"cacheWrite5m": "Cache Write (5m)",
"cacheWrite1h": "Cache Write (1h)",
"cacheRead": "Cache Read",
Expand Down Expand Up @@ -497,7 +498,12 @@
"endpoint": "Endpoint",
"error": "Upstream error",
"cancellation": "Cancellation reason",
"timeline": "Attempt timeline"
"timeline": "Attempt timeline",
"billing": "Cost and usage",
"billed": "Included in total cost",
"billedCost": "Billed cost",
"winnerCost": "Winner cost",
"notObtained": "Cancelled; usage unavailable"
},
"cancellationKinds": {
"discovery_loser": "Another Discovery attempt won",
Expand Down
6 changes: 3 additions & 3 deletions messages/en/settings/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
"billNonSuccessfulRequestsDesc": "When enabled, requests with non-success status (e.g., 499 client cancellation) are billed by token usage if upstream returned positive usage data. Default off.",
"billNonSuccessfulRequestsTooltip": "Useful when an upstream provider counts tokens regardless of the final status (e.g., aborted streaming responses). Fake-200 upstream errors remain unbilled.",
"billHedgeLosers": "Bill Provider-Racing Losers by Token Usage",
"billHedgeLosersDesc": "When provider racing (streaming hedge) is on, losing providers are kept connected in the background, drained for their token usage, and billed - their cost is added into this request's total. Default on.",
"billHedgeLosersTooltip": "Upstreams usually bill a request even after we cancel it. Keeping racing losers alive lets us reclaim their token counts so CCH's cost matches what every upstream actually charged. Each loser's cost is accumulated asynchronously into the request total.",
"billHedgeLosersDesc": "When provider racing (streaming hedge or bounded Discovery) is on, losers that have already produced a valid response prefix may be kept connected in the background, drained for usage, and billed. Their cost is added to this request's total. Other losers are cancelled. Default on.",
"billHedgeLosersTooltip": "Only losers with a readable valid response are drained. SLA timeouts, explicit failures, and attempts without a valid prefix are cancelled; their unknown upstream cost is not added.",
"discoveryEnabled": "Enable bounded provider Discovery",
"discoveryEnabledDesc": "When enabled, cold-start streaming requests probe multiple providers within a bounded window and keep at most one fallback. It is disabled by default.",
"discoveryConcurrency": "Discovery initial concurrency",
Expand All @@ -128,7 +128,7 @@
"stickyTimeoutCooldownMs": "Sticky timeout cooldown (milliseconds)",
"stickyBindingTtl": "Sticky binding validity",
"stickyBindingTtlDesc": "Read-only. This follows the SESSION_TTL environment variable and is shared with other session snapshots.",
"discoveryWindowDesc": "The total timeout must be at least Sticky SLA + maximum rounds × Discovery SLA. Discovery losers are cancelled and are not drained or billed by the legacy Hedge path.",
"discoveryWindowDesc": "The total timeout must be at least Sticky SLA + maximum rounds × Discovery SLA. With loser billing enabled, only ready Discovery losers may be drained; SLA timeouts and failed or no-prefix attempts remain cancelled.",
"discoveryWindowInvalid": "Discovery total timeout is shorter than the configured Sticky and Discovery windows.",
"discoverySettingsInvalid": "One or more Discovery values are outside the allowed range.",
"verboseProviderError": "Verbose Provider Error",
Expand Down
8 changes: 7 additions & 1 deletion messages/ja/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"title": "課金詳細",
"input": "入力",
"output": "出力",
"cacheWrite": "キャッシュ書き込み",
"cacheWrite5m": "キャッシュ書き込み (5m)",
"cacheWrite1h": "キャッシュ書き込み (1h)",
"cacheRead": "キャッシュ読み取り",
Expand Down Expand Up @@ -497,7 +498,12 @@
"endpoint": "エンドポイント",
"error": "上流エラー",
"cancellation": "キャンセル理由",
"timeline": "試行タイムライン"
"timeline": "試行タイムライン",
"billing": "費用と使用量",
"billed": "合計費用に計上済み",
"billedCost": "計上費用",
"winnerCost": "勝者の費用",
"notObtained": "キャンセル済み、使用量未取得"
},
"cancellationKinds": {
"discovery_loser": "別の Discovery 試行が勝利しました",
Expand Down
6 changes: 3 additions & 3 deletions messages/ja/settings/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
"billNonSuccessfulRequestsDesc": "有効にすると、非 2xx ステータス(例: クライアント中断による 499)のリクエストでも、上流が正の token 使用量を返した場合は使用量に応じて課金されます。既定はオフ。",
"billNonSuccessfulRequestsTooltip": "上流プロバイダーがレスポンス失敗時にも token をカウントするケース(ストリーム中断でも token を計上する等)に有用です。fake-200 の偽成功エラー応答は引き続き課金されません。",
"billHedgeLosers": "プロバイダー競争(hedge)の敗者を Token 使用量で課金",
"billHedgeLosersDesc": "プロバイダー競争(ストリーミング hedge)が有効な場合、競争に敗れたプロバイダーを即座に切断せず、バックグラウンドで接続を維持して token 使用量を取得し課金します。その費用はこのリクエストの合計に加算されます。既定はオン。",
"billHedgeLosersTooltip": "上流はこちらが能動的にキャンセルしたリクエストも通常は課金します。競争の敗者を生かしておくことで token 数を回収し、CCH の課金を各上流の実際の課金と一致させます。各敗者の費用は非同期にリクエストの費用へ加算されます。",
"billHedgeLosersDesc": "プロバイダー競争(ストリーミング hedge または制限付き Discovery)が有効な場合、有効な応答プレフィックスを受信済みの敗者だけをバックグラウンドで読み切って課金します。費用はリクエスト合計に加算され、それ以外の敗者はキャンセルされます。既定はオン。",
"billHedgeLosersTooltip": "読み取り可能な有効応答がある敗者だけを読み切ります。SLA タイムアウト、明示的な失敗、有効なプレフィックスがない試行はキャンセルされ、確認できない上流費用は加算されません。",
"discoveryEnabled": "制限付き Provider Discovery を有効化",
"discoveryEnabledDesc": "有効にすると、コールドスタートのストリーミングリクエストで複数 Provider を制限時間内に探索し、フォールバックを最大 1 つ保持します。既定はオフです。",
"discoveryConcurrency": "Discovery 初期並列数",
Expand All @@ -130,7 +130,7 @@
"stickyTimeoutCooldownMs": "Sticky タイムアウト後のクールダウン(ミリ秒)",
"stickyBindingTtl": "Sticky バインドの有効期間",
"stickyBindingTtlDesc": "読み取り専用です。この値は環境変数 SESSION_TTL に従い、他の Session スナップショットと共有されます。",
"discoveryWindowDesc": "合計タイムアウトは Sticky SLA + 最大ラウンド数 × Discovery SLA 以上にしてください。",
"discoveryWindowDesc": "合計タイムアウトは Sticky SLA + 最大ラウンド数 × Discovery SLA 以上にしてください。敗者課金を有効にした場合も、有効な応答を受信済みの Discovery 敗者だけを読み切り、SLA タイムアウトや失敗はキャンセルします。",
"discoveryWindowInvalid": "Discovery 合計タイムアウトが設定された Sticky/Discovery ウィンドウより短くなっています。",
"discoverySettingsInvalid": "1 つ以上の Discovery 設定値が許容範囲外です。",
"verboseProviderError": "詳細なプロバイダーエラー",
Expand Down
8 changes: 7 additions & 1 deletion messages/ru/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"title": "Детали биллинга",
"input": "Входные",
"output": "Выходные",
"cacheWrite": "Запись в кэш",
"cacheWrite5m": "Запись кэша (5m)",
"cacheWrite1h": "Запись кэша (1h)",
"cacheRead": "Чтение кэша",
Expand Down Expand Up @@ -497,7 +498,12 @@
"endpoint": "Upstream",
"error": "Ошибка upstream",
"cancellation": "Причина отмены",
"timeline": "Хронология попытки"
"timeline": "Хронология попытки",
"billing": "Стоимость и использование",
"billed": "Включено в общую стоимость",
"billedCost": "Начисленная стоимость",
"winnerCost": "Стоимость победителя",
"notObtained": "Отменено, usage не получен"
},
"cancellationKinds": {
"discovery_loser": "Победила другая попытка Discovery",
Expand Down
6 changes: 3 additions & 3 deletions messages/ru/settings/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
"billNonSuccessfulRequestsDesc": "Если включено, запросы с не-2xx статусом (например, 499 при отмене клиентом) будут тарифицироваться по фактическому количеству токенов, если апстрим вернул положительные данные об использовании. По умолчанию выключено.",
"billNonSuccessfulRequestsTooltip": "Полезно, когда апстрим считает токены даже при неудачном статусе (например, прерванные стриминговые ответы). Поддельные ответы 200 (fake-200) по-прежнему не тарифицируются.",
"billHedgeLosers": "Тарифицировать проигравших в гонке провайдеров по токенам",
"billHedgeLosersDesc": "Когда включена гонка провайдеров (streaming hedge), проигравшие провайдеры не отключаются сразу, а остаются на связи в фоне, дочитываются для получения использования токенов и тарифицируются - их стоимость добавляется в общую стоимость этого запроса. По умолчанию включено.",
"billHedgeLosersTooltip": "Апстримы обычно тарифицируют запрос, даже если мы его отменили. Сохраняя проигравших в гонке, мы получаем их счётчики токенов, чтобы расходы CCH совпадали с тем, что фактически списал каждый апстрим. Стоимость каждого проигравшего асинхронно добавляется к стоимости запроса.",
"billHedgeLosersDesc": "Если включена гонка провайдеров (streaming hedge или ограниченный Discovery), в фоне дочитываются и тарифицируются только проигравшие, уже отдавшие корректный префикс ответа. Их стоимость добавляется к общей стоимости запроса. Остальные проигравшие отменяются. По умолчанию включено.",
"billHedgeLosersTooltip": "Дочитываются только проигравшие с доступным корректным ответом. Тайм-ауты SLA, явные ошибки и попытки без корректного префикса отменяются; неизвестная стоимость апстрима не добавляется.",
"discoveryEnabled": "Включить ограниченное обнаружение провайдеров",
"discoveryEnabledDesc": "При включении потоковые запросы холодного старта проверяют несколько провайдеров в ограниченном окне и сохраняют не более одного резервного. По умолчанию выключено.",
"discoveryConcurrency": "Начальная параллельность Discovery",
Expand All @@ -130,7 +130,7 @@
"stickyTimeoutCooldownMs": "Пауза после тайм-аута Sticky (миллисекунды)",
"stickyBindingTtl": "Срок действия привязки Sticky",
"stickyBindingTtlDesc": "Только для чтения. Значение следует переменной окружения SESSION_TTL и используется другими снимками Session.",
"discoveryWindowDesc": "Общий тайм-аут должен быть не меньше SLA Sticky + максимальное число раундов × SLA Discovery.",
"discoveryWindowDesc": "Общий тайм-аут должен быть не меньше SLA Sticky + максимальное число раундов × SLA Discovery. При включённой тарификации проигравших дочитываются только готовые проигравшие Discovery; тайм-ауты SLA и ошибки остаются отменёнными.",
"discoveryWindowInvalid": "Общий тайм-аут Discovery меньше настроенного окна Sticky и Discovery.",
"discoverySettingsInvalid": "Одно или несколько значений Discovery находятся вне допустимого диапазона.",
"verboseProviderError": "Подробные ошибки провайдеров",
Expand Down
8 changes: 7 additions & 1 deletion messages/zh-CN/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"title": "计费详情",
"input": "输入",
"output": "输出",
"cacheWrite": "缓存写入",
"cacheWrite5m": "缓存写入 (5m)",
"cacheWrite1h": "缓存写入 (1h)",
"cacheRead": "缓存读取",
Expand Down Expand Up @@ -497,7 +498,12 @@
"endpoint": "端点",
"error": "上游错误",
"cancellation": "取消原因",
"timeline": "尝试时间线"
"timeline": "尝试时间线",
"billing": "费用与用量",
"billed": "已计入总费用",
"billedCost": "已计入费用",
"winnerCost": "赢家费用",
"notObtained": "已取消,未取得用量"
},
"cancellationKinds": {
"discovery_loser": "其他 Discovery 尝试已胜出",
Expand Down
6 changes: 3 additions & 3 deletions messages/zh-CN/settings/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"billNonSuccessfulRequestsDesc": "开启后,对于响应非 2xx 状态码(例如客户端中断的 499)的请求,只要上游返回了正向 token 用量,仍按用量计费。默认关闭。",
"billNonSuccessfulRequestsTooltip": "适用于上游供应商即使响应失败也按 token 计费的场景(如流式中断时仍计入 token)。fake-200 假成功错误响应仍不会计费。",
"billHedgeLosers": "对供应商竞速输家计费",
"billHedgeLosersDesc": "开启供应商竞速后,竞速落败的供应商不再被直接掐断,而是在后台保持连接、拿回其 token 用量并计费,其费用会累加进本条请求的总花费。默认开启。",
"billHedgeLosersTooltip": "上游通常即使请求被我们主动取消也照样计费。保活竞速输家可以拿回它们的 token 计数,使 CCH 的扣费与每个上游实际扣费保持一致。每个输家的费用都会异步累加到该请求的花费中。",
"billHedgeLosersDesc": "开启供应商竞速(流式 Hedge 或有界 Discovery)后,只有已经收到有效响应前缀的输家会在后台继续读取并按用量计费,费用会累加到本条请求总花费;其他输家会取消。默认开启。",
"billHedgeLosersTooltip": "只保活已经收到可读取有效响应的输家;SLA 超时、明确失败或未取得有效首字的请求会取消,无法确认的上游费用不会计入。",
"discoveryEnabled": "启用有界供应商 Discovery",
"discoveryEnabledDesc": "启用后,冷启动流式请求会在限定窗口内探测多个供应商,并且最多保留一个保底请求。默认关闭。",
"discoveryConcurrency": "Discovery 首轮并发数",
Expand All @@ -57,7 +57,7 @@
"stickyTimeoutCooldownMs": "Sticky 超时冷却(毫秒)",
"stickyBindingTtl": "Sticky 绑定有效期",
"stickyBindingTtlDesc": "只读;该值跟随环境变量 SESSION_TTL,并与其他 Session 快照共用。",
"discoveryWindowDesc": "总超时必须不小于 Sticky SLA + 最大轮数 × Discovery SLA。Discovery 输家会取消,不走旧 Hedge 的 drain 或输家计费。",
"discoveryWindowDesc": "总超时必须不小于 Sticky SLA + 最大轮数 × Discovery SLA。开启输家计费后,只有已取得有效首字的 Discovery 输家会后台读取;SLA 超时、失败或未取得首字的请求仍会取消。",
"discoveryWindowInvalid": "Discovery 总超时短于已配置的 Sticky 与 Discovery 窗口。",
"discoverySettingsInvalid": "一个或多个 Discovery 配置值超出允许范围。",
"verboseProviderError": "详细供应商错误信息",
Expand Down
8 changes: 7 additions & 1 deletion messages/zh-TW/dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"title": "計費詳情",
"input": "輸入",
"output": "輸出",
"cacheWrite": "快取寫入",
"cacheWrite5m": "快取寫入(5m)",
"cacheWrite1h": "快取寫入(1h)",
"cacheRead": "快取讀取",
Expand Down Expand Up @@ -497,7 +498,12 @@
"endpoint": "端點",
"error": "上游錯誤",
"cancellation": "取消緣由",
"timeline": "嘗試時間線"
"timeline": "嘗試時間線",
"billing": "費用與用量",
"billed": "已計入總費用",
"billedCost": "已計入費用",
"winnerCost": "贏家費用",
"notObtained": "已中止,未取得用量"
},
"cancellationKinds": {
"discovery_loser": "其他 Discovery 嘗試已勝出",
Expand Down
Loading