Skip to main content

Module pricing

Module pricing 

Source
Expand description

LiteLLM-sourced per-model pricing: the parser plus the proxy-aware fetch that populates the runtime cache.

Pricing is sourced at runtime from LiteLLM’s raw file and cached in redb (forge_workspace::store::pricing); there is no bundled copy.

Re-exports§

use std::collections::HashMap; 🔒
use std::time::Duration; 🔒
use forge_primitives::token_usage::ModelPricing; 🔒

Structs§

PricingTable
Per-model USD pricing keyed by the exact message.model id.

Constants§

FETCH_TIMEOUT 🔒
Bound on the pricing fetch; the file is ~1.6 MB.
LITELLM_URL 🔒
LiteLLM’s community-maintained price table (prices Claude and the OpenAI/Codex ids in one file).

Functions§

attempt_fetch 🔒
fetch_litellm
Fetch the raw LiteLLM pricing file. Honours an ambient HTTPS_PROXY first, then retries once directly so a dead proxy doesn’t block the fetch. None on any network failure (the caller keeps the last-good cache).