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
+5
View File
@@ -1524,6 +1524,10 @@ impl Session {
.get_param::<String>("GOOSE_PROVIDER") .get_param::<String>("GOOSE_PROVIDER")
.unwrap_or_else(|_| "unknown".to_string()); .unwrap_or_else(|_| "unknown".to_string());
// Do not get costing information if show cost is disabled
// This will prevent the API call to openrouter.ai
// This is useful if for cases where openrouter.ai may be blocked by corporate firewalls
if show_cost {
// Initialize pricing cache on startup // Initialize pricing cache on startup
tracing::info!("Initializing pricing cache..."); tracing::info!("Initializing pricing cache...");
if let Err(e) = initialize_pricing_cache().await { if let Err(e) = initialize_pricing_cache().await {
@@ -1531,6 +1535,7 @@ impl Session {
"Failed to initialize pricing cache: {e}. Pricing data may not be available." "Failed to initialize pricing cache: {e}. Pricing data may not be available."
); );
} }
}
match self.get_metadata() { match self.get_metadata() {
Ok(metadata) => { Ok(metadata) => {