Do not fetch pricing information if GOOSE_CLI_SHOW_COST is false (#3901)

Co-authored-by: Jack Wright <jack.wright@nike.com>
This commit is contained in:
Jack Wright
2025-08-14 09:21:32 -07:00
committed by GitHub
parent 09f0cf7507
commit e173c221ff
+11 -6
View File
@@ -1524,12 +1524,17 @@ impl Session {
.get_param::<String>("GOOSE_PROVIDER") .get_param::<String>("GOOSE_PROVIDER")
.unwrap_or_else(|_| "unknown".to_string()); .unwrap_or_else(|_| "unknown".to_string());
// Initialize pricing cache on startup // Do not get costing information if show cost is disabled
tracing::info!("Initializing pricing cache..."); // This will prevent the API call to openrouter.ai
if let Err(e) = initialize_pricing_cache().await { // This is useful if for cases where openrouter.ai may be blocked by corporate firewalls
tracing::warn!( if show_cost {
"Failed to initialize pricing cache: {e}. Pricing data may not be available." // Initialize pricing cache on startup
); tracing::info!("Initializing pricing cache...");
if let Err(e) = initialize_pricing_cache().await {
tracing::warn!(
"Failed to initialize pricing cache: {e}. Pricing data may not be available."
);
}
} }
match self.get_metadata() { match self.get_metadata() {