Add per-thread usage queries to the backend client (#38270)

## What changed

- Add `Client::get_thread_usage` for querying authoritative estimated credit
  and dollar usage for a thread across both supported backend path styles.
- Expose usage totals and optional model, reasoning effort, speed, and token
  breakdowns through `ThreadUsage` and `ThreadUsageBreakdownGroup`.
- Reject responses that do not include the requested thread.

## Testing

- Cover endpoint paths, request serialization, complete and partial usage
  responses, and mismatched thread IDs.

GitOrigin-RevId: 16c83590b2c804e0182b4493cf2aa39206029c77
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-08-12 22:58:46 +00:00
1 parent 5664a5c07c
commit 842fae26c9
4 files changed
+240

No files matched your search

+4
View File
@@ -35,6 +35,10 @@ use serde::de::DeserializeOwned;
use std::fmt;
mod rate_limit_resets;
mod thread_usage;
pub use thread_usage::ThreadUsage;
pub use thread_usage::ThreadUsageBreakdownGroup;
#[derive(Debug)]
pub enum RequestError {