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
34 changes: 17 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ categories = ["network-programming", "web-programming::http-server"]

# 二进制走 CalVer,crate 走 SemVer —— 两者是两回事,卖给不同的人。
# 这里是 crate 的版本。
version = "0.53.0"
version = "0.54.0"

[workspace.dependencies]
# ── 内部 crate ───────────────────────────────────────────
Expand Down
18 changes: 18 additions & 0 deletions release-notes/0.54.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This release records when each response's first token arrives and how fast the response is generated, and corrects the generation rate that `GET /live` reports.

**Upgrade notes**

- The control-plane protocol version (`CONTROL_API_VERSION`) is now 27. ThinkWatch Lite connects only to a core with the same protocol version, and has to regenerate its protocol types from this release to use it. ThinkWatch Lite 2026.9.21 includes 0.53.0 (protocol 26) and does not connect to 0.54.0: a server used with it stays on 0.53.0 until the app is updated to a release that includes 0.54.0. `sudo twcore upgrade --version 0.53.0 --restart` switches a server back to 0.53.0.
- The format of the request history changed (request store schema 22, from 21). On its first start, 0.54.0 replaces the request history and the stored request and response bodies of an earlier version with an empty store; the configuration is kept. Switching back to an earlier version empties it again.
- Changed in the protocol: the new event `RequestFirstToken { id, ttft_ms }`, `RequestFinished.tokens_per_sec`, `HistoryRow.ttft_ms` and `HistoryRow.tokens_per_sec`, and the new endpoints `GET /token-rate` and `GET /token-rate/provider`, which return `TokenRateView { model, p50, samples }`. `GET /latency` and `GET /latency/provider` now report the time to the first token. No message code changed.

**First token.** The headers of a streamed response usually come back as soon as the upstream receives the request. The upstream then queues the request and reads the prompt before it produces anything, and the time a user waits is the time to the first token, not to the headers. The gateway now reads each successful streamed response in the upstream's format and reports the moment the first text, reasoning or tool call arrives; opening frames such as `message_start` and `response.created` do not count. A response that is not streamed arrives whole and has no first token. `GET /latency` and `GET /latency/provider` now give percentiles of this time, so responses that are not streamed are left out of them. `url-test` groups still pick the upstream with the fastest response headers.

**Generation speed.** Each finished streamed request has a generation speed: the output produced after the first token, divided by the time from the first token to the end.
- When the model reasoned before the first token without streaming its reasoning, those reasoning tokens were generated outside that time. They are subtracted when the upstream reports how many there were, as OpenAI and Gemini do. When it does not, as with Anthropic, the request has no speed rather than one several times too high.
- Reasoning that is streamed as it happens is counted.
- Responses that are not streamed, cancelled and failed requests, and generations shorter than half a second have no speed.

`GET /token-rate` and `GET /token-rate/provider` give the median speed by model and by upstream, with the number of samples.

**The live rate.** `GET /live` used to divide each request's output by the time after its response headers. A response that is not streamed gets its headers only when generation is done, so that time was a few milliseconds, and one such request could push the rate to tens of thousands of tokens per second. The rate now combines the speeds of the requests that have one, weighted by their generation time.
Loading