Expand description
2026-09-26: A minimal OpenAI-compatible client over raw HTTP/1.1 on
tokio::net::TcpStream, with no TLS: one streaming chat call, measured
(chat_stream), plus the blocking, GET, gap and failure helpers in the
submodules. Chunked transfer-encoding is decoded by the private reader
module before SSE lines are split, so a chunk boundary inside a data:
line does not lose a token.
Owner: bench (HTTP client). Invariants:
- A 200 stream that ends with neither
[DONE]nor afinish_reasonis an error, never a success. - An in-band SSE error frame is an error, never a success.
Re-exports§
pub use gaps::GapSample;pub use gaps::GapStats;pub use gaps::itl_ms;pub use failure::FailureKind;pub use failure::RequestFailure;pub use failure::classify;
Modules§
- failure
- 2026-09-26: Why a streamed chat request failed, as data a caller can classify.
- gaps
- 2026-09-26: Arrival-gap accumulator: the within-response jitter instrument.
Structs§
- Blocking
Outcome - 2026-09-26: What a non-streaming chat-completions or Responses request returned.
- Chat
Outcome - 2026-09-26: Everything one request produced, plus its timings.
- Tool
Call - 2026-09-26: A tool call assembled from streamed deltas.
Functions§
- chat_
blocking - 2026-09-26: POST to
/v1/chat/completionsand read the whole JSON response. Errors on a timeout, a non-200 (with the server’s message when readable) and a body that is not JSON. - chat_
stream - 2026-09-26: POST
bodyto/v1/chat/completionsas an SSE request and measure it. A request that exceedstimeoutfails asFailureKind::Timeout. - chat_
stream_ signalled - 2026-10-04:
chat_stream, plus a signal:first_token, when given, receives the instant the first token-carrying chunk arrived (the instantttft_msis measured to) while the stream is still running. A request that ends before any token drops the sender, so the receiver sees an error instead of waiting. - error_
message_ from_ response - 2026-09-26: The message from a complete non-200 HTTP response (status
line, headers and body), decoded by the same private reader as streams,
chunked bodies included.
Noneunless the response is a non-200 whose bodymessage_from_bodycan read. - fetch_
hardware - 2026-09-26:
GET /hardware: the serving box’s hardware fingerprint. - get_
json - 2026-09-26:
GET <path>and parse the first JSON value of the reply (a chunked reply carries framing after the document). A status other than 200 is an error that quotes the document. - get_
text - 2026-10-04:
GET <path>and return the body as text, chunked framing decoded, lines joined with\nand each trimmed. A status other than 200 is an error that quotes the body (the streaming client’sReaderdoes both). A body pastTEXT_BODY_LIMITis an error, so a cut-off page never reads as a page without the series that were cut. - list_
models - message_
from_ body - 2026-09-26: The trimmed
error.messageof an OpenAI-shaped error body.Nonewhen the body is not JSON with a non-empty string there, so callers can fall back to the status line. - probe
- 2026-09-26: Reachability check:
GET /v1/modelsmust answer 200 withintimeout. Every benchmark driver except vision and video calls it. - responses_
blocking - 2026-09-26: The same as
chat_blocking, against the Responses API (/v1/responses).