Repository navigation
Run the inference speed test the way each upstream expects - #28
Merged
Merged
Conversation
The L3 speed test built one request for every upstream: an Anthropic body posted to /v1/messages, without anthropic-version, through the default HTTP client. Three things went wrong with that, and each was reported to the user as "this upstream does not work": - Upstreams behind a proxy were unreachable. Only the OAuth token refresh used the upstream's own client; the probe itself went out directly. - The official Anthropic API rejects a request without anthropic-version with a 400. - OpenAI chat upstreams got a 404, since /v1/messages is not their route. The probe now picks its path, body and headers from the protocol, and runs through the upstream's own client. Protocols without a probe yet (Responses, Gemini) say so and send nothing, rather than sending a request that is bound to fail. The quote's total also stops treating a subscription upstream like an unpriced one. Both have no amount, but only "per-token and unknown" makes a total untrustworthy; selecting a subscription upstream used to hide the cost of every other upstream in the batch. A subscription is also taken from the config's `billing`, not only from quota headers seen so far. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR. One thing before review: this targets
No need to close and reopen: click Edit next to the PR title and change the base branch to See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The L3 speed test sent every upstream the same request: an Anthropic body to
/v1/messages, with noanthropic-version, through the default HTTP client. Every one of these was reported to the user as "this upstream does not work":anthropic-version./v1/messagesis not their route.Separately, selecting a subscription upstream voided the quote's total. The subscription item has no amount, and the total treated that the same as an unpriced model, so the cost of every other upstream in the batch disappeared.
What changed
l3::probe_requestpicks the path, body and headers from the protocol. Anthropic getsanthropic-version. OpenAI chat goes to/v1/chat/completionsand asks for usage in the stream. Responses and Gemini have no probe yet: they say so and send nothing.speed_runsends the probe throughclient_for(provider), the same client forwarding uses.Estimate/SpeedEstimategainsubscription.total_microsskips subscription items, and is stillNonewhen a per-token item has no price. A subscription is taken frombilling: subscriptionin the config as well as from quota headers.Tests
crates/tw-control/tests/speed.rs:speed_runis switched back to the default client; I checked.cargo fmt --check,clippy -D warnings,cargo test --workspace: all pass.scripts/smoke.sh: 48 passed, 0 failed, 1 over target without regressing (memory 36 MB against 30 MB, same as before).🤖 Generated with Claude Code