Defines telemetry events for API failures, rate limits, and internal errors in Grok API client. Use for monitoring and analytics.
// Source: https://github.com/xai-org/grok-build | License: Apache-2.0 | Copyright 2023-2026 SpaceXAI
// Provided via justclaw.it.com; keep this notice with the code.
//! API/internal error product telemetry events.
use serde::Serialize;
/// Emitted when a user's turn fails due to rate limiting (all retries exhausted).
/// Key conversion-funnel signal: rate limit, then upsell, then subscribe.
#[derive(Serialize)]
pub struct RateLimitHit {
pub model_id: String,
/// Number of retry attempts before giving up.
pub attempts: u32,
}
/// Model-API failure at the turn level (non-rate-limit).
/// Category/class only, no message text (external `api_error` event; also a product event).
#[derive(Serialize)]
pub struct ApiError {
/// Fixed classification (`auth`, `server_error`, `tim
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key