Skip to main content

fetch_usage_raw

Function fetch_usage_raw 

Source
pub fn fetch_usage_raw(token: &str) -> Result<String, ApiError>
Expand description

Fetch raw usage data from the Anthropic API (blocking).

This function makes a synchronous HTTP request to the usage API and returns the raw JSON response body.

§Arguments

  • token - OAuth access token for authentication

§Errors

Returns ApiError if:

  • Network request fails
  • Server returns 401 (unauthorized)
  • Server returns 429 (rate limited)
  • Server returns 5xx (server error)
  • Server returns unexpected status code

§Security

The token is used only for this request and is not stored.