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
2 changes: 1 addition & 1 deletion src/content/docs-lite/en/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ A relay or vendor can hand out an import link, `thinkwatch://import?…` or its

Each key follows a route, and keys without one follow the default route. A route is a list of rules evaluated in order. A rule matches on the model, the key, the client's API format, input tokens, `max_tokens`, the number of tools, images, extended thinking, streaming, prompt caching or the kind of auxiliary request; it then forwards the request to an upstream or a group, or refuses it, and can rewrite the model, `max_tokens` or extended thinking. Setting `max_tokens` caps the length of answers: the upstream stops at that point by itself, without an error. A group puts several upstreams behind one name and decides the order in which they are tried: as listed, manually selected, in turn, lowest latency first or lowest cost first. When an attempt fails, the request moves on to the next upstream, and by default a session stays on one upstream so that its prompt cache keeps hitting. A map at the top of the page traces every key through its route and groups to the upstreams.

Auxiliary requests that clients send on their own (health checks, warm-ups, titles, topic detection and input suggestions) can be answered locally at no cost, passed through, or routed by the rules.
Auxiliary requests that clients send on their own (health checks, warm-ups, titles, topic detection and input suggestions) can be answered locally at no cost, or forwarded. Forwarded ones go through the routing rules like any other request, and a rule can send a given kind to a lower-cost upstream.

Every request records the rule it matched, the group it went through and each attempt with its status and duration. A dry run evaluates the rules for a given request and shows where it would go and why, without sending anything and without incurring any cost.

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs-lite/zh-CN/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ API 密钥和请求头的值可以写成 `${变量名}`,读取系统环境变

每把密钥使用一条路由,未指定的使用默认路由。路由由按顺序匹配的规则组成。规则的条件包括模型、密钥、客户端的 API 格式、输入 token 数、`max_tokens`、工具数量、图片、扩展思考、流式、提示缓存以及辅助请求的类型;命中后把请求交给某个上游或策略组,或拒绝请求,也可以改写模型、`max_tokens` 或扩展思考。设置 `max_tokens` 可以限制回答的长度:上游到达上限时自行停止,不会报错。策略组把多个上游放在同一个名字下,并决定尝试的先后:按顺序、手动选择、轮询、延迟最低优先或费用最低优先。一次尝试失败时,请求转到下一个上游;同一会话默认保持在同一个上游上,以便提示缓存持续命中。页面顶部的路由图显示每把密钥经过的路由、策略组和上游。

客户端自行发出的辅助请求(连通性检查、预热、生成标题、话题识别、输入建议)可以由网关在本地应答而不产生费用,也可以直接转发,或交给路由规则处理。
客户端自行发出的辅助请求(连通性检查、预热、生成标题、话题识别、输入建议)可以由网关在本地应答而不产生费用,也可以转发。转发的辅助请求和普通请求一样经过路由规则,规则可以按辅助请求的类型把它们分流到费用更低的上游。

每个请求都记录命中的规则、经过的策略组,以及每一次尝试的状态与耗时。试算按给定的请求条件逐条匹配规则,说明请求会交给哪个上游及其原因,不发出请求,也不产生费用。

Expand Down
21 changes: 11 additions & 10 deletions src/data/core-docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,21 +556,22 @@ pricing:
### `client_probes`

Some requests clients send are not the user's: connectivity checks,
warm-ups, session titles, topic detection, suggestions. Each class can be
answered locally (`intercept`, nothing is sent upstream), passed through
(`passthrough`), or handed to the routing rules (`route`, matched with
`when.intent`). The defaults intercept only what nobody would miss.
warm-ups, session titles, topic detection, suggestions. Each class is either
answered locally (`intercept`, nothing is sent upstream) or forwarded
(`forward`). Forwarded ones go through the routing rules like any other
request and carry their class, so a rule can catch them with `when.intent`.
The defaults intercept only what nobody would miss.

<!-- generated: table client_probes -->
<a id="cfg-client_probes"></a>

| Field | Type | Default | Description |
|---|---|---|---|
| `health_check` | `intercept` \| `passthrough` \| `route` | `intercept` | Connectivity checks (`max_tokens: 1`). Answered locally by default: nothing is lost. |
| `warmup` | `intercept` \| `passthrough` \| `route` | `intercept` | Warm-up requests. Answered locally by default. |
| `titling` | `intercept` \| `passthrough` \| `route` | `passthrough` | Requests that name a session. Passed through by default: intercepting them gives every session the same title. |
| `topic_detect` | `intercept` \| `passthrough` \| `route` | `passthrough` | Topic detection. Passed through by default. |
| `suggestion` | `intercept` \| `passthrough` \| `route` | `passthrough` | Suggestions. Passed through by default. |
| `health_check` | `intercept` \| `forward` | `intercept` | Connectivity checks (`max_tokens: 1`). Answered locally by default: nothing is lost. |
| `warmup` | `intercept` \| `forward` | `intercept` | Warm-up requests. Answered locally by default. |
| `titling` | `intercept` \| `forward` | `forward` | Requests that name a session. Forwarded by default: intercepting them gives every session the same title. |
| `topic_detect` | `intercept` \| `forward` | `forward` | Topic detection. Forwarded by default. |
| `suggestion` | `intercept` \| `forward` | `forward` | Suggestions. Forwarded by default. |
<!-- /generated -->

### `security`
Expand Down Expand Up @@ -964,7 +965,7 @@ order they are declared.
| `image` | bool | — | Whether the request contains an image. |
| `thinking` | bool | — | Whether extended thinking is on. |
| `stream` | bool | — | Whether the response is streamed. |
| `intent` | string or list of strings | — | A client helper request: `assistant_internal` for any of them, or one class (`titling`). Only classes set to `route` in `client_probes` reach routing. |
| `intent` | string or list of strings | — | A client helper request: `assistant_internal` for any of them, or one class (`titling`). Classes set to `intercept` in `client_probes` are answered locally and never reach routing. |
| `provider_would_be` | string or list of strings | — | The upstream routing chose. Such a rule is evaluated after routing, may only `set` or `deny`, and cannot have `to`. |
<!-- /generated -->

Expand Down
14 changes: 7 additions & 7 deletions src/data/core-docs/config.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,18 @@ pricing:

### `client_probes`

客户端发出的请求中,有一部分并非出自使用者:连通性检查、预热、会话标题、话题检测、建议。每一类都可以在本地应答(`intercept`,不向上游发送任何内容)、原样放行(`passthrough`),或交给路由规则(`route`,由 `when.intent` 匹配)。默认只拦下拦了也不会少任何东西的那几类。
客户端发出的请求中,有一部分并非出自使用者:连通性检查、预热、会话标题、话题检测、建议。每一类要么在本地应答(`intercept`,不向上游发送任何内容),要么转发(`forward`)。转发的请求和普通请求一样经过路由规则,并带着自己的类别,规则可以用 `when.intent` 匹配。默认只拦下拦了也不会少任何东西的那几类。

<!-- generated: table client_probes -->
<a id="cfg-client_probes"></a>

| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| `health_check` | `intercept` \| `passthrough` \| `route` | `intercept` | 连通性检查(`max_tokens: 1`)。默认在本地应答,不影响任何功能。 |
| `warmup` | `intercept` \| `passthrough` \| `route` | `intercept` | 预热请求。默认在本地应答。 |
| `titling` | `intercept` \| `passthrough` \| `route` | `passthrough` | 为会话起标题的请求。默认放行:拦下后所有会话都会是同一个标题。 |
| `topic_detect` | `intercept` \| `passthrough` \| `route` | `passthrough` | 话题检测。默认放行。 |
| `suggestion` | `intercept` \| `passthrough` \| `route` | `passthrough` | 建议。默认放行。 |
| `health_check` | `intercept` \| `forward` | `intercept` | 连通性检查(`max_tokens: 1`)。默认在本地应答,不影响任何功能。 |
| `warmup` | `intercept` \| `forward` | `intercept` | 预热请求。默认在本地应答。 |
| `titling` | `intercept` \| `forward` | `forward` | 为会话起标题的请求。默认转发:拦下后所有会话都会是同一个标题。 |
| `topic_detect` | `intercept` \| `forward` | `forward` | 话题检测。默认转发。 |
| `suggestion` | `intercept` \| `forward` | `forward` | 建议。默认转发。 |
<!-- /generated -->

### `security`
Expand Down Expand Up @@ -774,7 +774,7 @@ security:
| `image` | 布尔 | — | 请求是否包含图片。 |
| `thinking` | 布尔 | — | 是否开启扩展思考。 |
| `stream` | 布尔 | — | 是否流式返回。 |
| `intent` | 字符串或字符串列表 | — | 客户端的辅助请求:`assistant_internal` 表示任意一类,也可以写具体的一类(`titling`)。只有在 `client_probes` 中设为 `route` 的类别才会进入路由。 |
| `intent` | 字符串或字符串列表 | — | 客户端的辅助请求:`assistant_internal` 表示任意一类,也可以写具体的一类(`titling`)。在 `client_probes` 中设为 `intercept` 的类别由本地应答,不会进入路由。 |
| `provider_would_be` | 字符串或字符串列表 | — | 路由选中的上游。这类规则在路由完成后求值,只能 `set` 或 `deny`,不能写 `to`。 |
<!-- /generated -->

Expand Down
6 changes: 3 additions & 3 deletions src/data/core-docs/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"repository": "ThinkWatchProject/ThinkWatch-Core",
"ref": "v0.59.0",
"ref": "v0.60.0",
"files": {
"docs/config.md": "0122d660347a3f0e398f42dc9942901996a70e4531ba77a741248e6f97f932fc",
"docs/config.zh-CN.md": "61c6668435399af55e8d385ce80e3e116c1420feff97440b898ec265f65174af",
"docs/config.md": "c5ccc802e4f502e28b468eab6b995ae737cc2a04a46bfe8012c89560bdf4ade1",
"docs/config.zh-CN.md": "feba4c83df62f5fcf8c8dfad6b3c70d6f6ebc8e3e6c05f6b428d6ec80351da9a",
"docs/server.md": "5e1e9b901bef2b46d417aea057a1db24c78457d3c1938b8540ecb4766515b68f",
"docs/server.zh-CN.md": "1f508e7c39b8ded28653773ca4d8701e6bdc2247bcd359c3a8fd00fd1401a6ff"
}
Expand Down
Loading