litellm terminal noise: quiet as a default, and the no-fetch stamp on every lane - #473
Merged
Conversation
…them _openai_agent asks litellm which provider serves a model twice (_openai_protocol, _cache_extra_args) before _openai_model flips suppress_debug_info, and openai_agent_config's litellm/ branch never flipped it at all; a managed cloud client runs no preload, so each failed lookup still print()ed the "Provider List:" banner. Quiet at the two get_llm_provider call sites instead, which covers every lane. Also: LITELLM_LOG at ERROR or above now clamps to that level (CRITICAL used to skip the clamp and end up noisier than unset); the retry notice is logged only when a retry follows; test_preload_stamps_litellm_log_level no longer leaks LITELLM_LOG=ERROR into the session; the config-time repair test covers _quiet_litellm with the preload thread pinned off. Claude-Session: https://claude.ai/code/session_01Gq5Kwi7wEgQNVT4k1XUhq9
…s itself now Since 30652ca each get_llm_provider caller and every completion helper flips the banner switch and clamps litellm's logger before touching litellm, so the background import's own _quiet_litellm() had no path left that depended on it; it was also the one place that mutated process-global logging at a moment the caller could not predict. The env stamps stay: import-time records still need them. The config-time repair test no longer needs the preload guard pinned. Claude-Session: https://claude.ai/code/session_01Gq5Kwi7wEgQNVT4k1XUhq9
… covers every lane _quiet_litellm() set litellm's loggers to ERROR on every entry, overriding whatever the host, litellm._turn_on_debug(), or LITELLM_LOG=DEBUG had set. It now sets a level only while a logger is still NOTSET: the default stays ERROR, anything set explicitly wins, and there is no per-call setLevel churn. LITELLM_LOCAL_MODEL_COST_MAP moves from the client's preload to utils' import. The CLI pipeline and openai_agent_config on a cloud client import litellm without the preload and fetched the remote model map on first use (offline: a WARNING). Every litellm lane imports utils first. The LITELLM_LOG=ERROR stamp is gone: it pinned litellm's stderr handler at ERROR for the whole process (silencing _turn_on_debug for good) while the logger level was what actually gated the chatter — output verified identical with and without it across plain, logging-configured, and debug hosts. Claude-Session: https://claude.ai/code/session_01CrSg9uRBvzVujNyU25Wmgk
_default_max_tokens is reached from anthropic_runner_config/messages(). On a managed cloud client the constructor never imports pageindex.utils, and local_chat deliberately keeps utils off its import path, so that lane imported litellm with LITELLM_LOCAL_MODEL_COST_MAP unset: the model cost map was fetched over the network (3517 entries vs the bundled 2982) and offline printed the very warning this branch removes. Verified end to end through the public API, before and after. Claude-Session: https://claude.ai/code/session_01CrSg9uRBvzVujNyU25Wmgk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lands the litellm terminal-noise follow-ups reviewed on
fix/litellm-warning(review view: #458). Seven commits, cherry-picked onto currentmain.What changes
The banner switch flips where the lookup happens.
_openai_agentasks LiteLLM which provider serves a model twice before building the model, andopenai_agent_configasks with no model built at all. A failed lookupprint()s the red "Provider List:" banner into stdout, mid-answer._quiet_litellm()now runs at bothget_llm_providercall sites, so every lane is covered.Quieting litellm's loggers is a default, not a clamp.
_quiet_litellm()used to set the four litellm loggers to ERROR on every call, overriding whatever the host application,litellm._turn_on_debug(), orLITELLM_LOG=DEBUGhad set. It now sets a level only while a logger is stillNOTSET. Unset stays ERROR as before; anything set explicitly wins, and there is no per-callsetLevelchurn.The no-fetch default covers every lane.
LITELLM_LOCAL_MODEL_COST_MAPmoved from the client's preload toutils' module scope. The CLI pipeline andopenai_agent_config/anthropic_runner_configon a managed cloud client never run that preload, so they fetched litellm's model cost map over the network on first import, and printed a warning when offline.run_pageindex.pyno longer needs its own copy of the stamp.The thinking-budget ceiling stopped outrunning the stamp.
_default_max_tokens, reached fromanthropic_runner_configandmessages(), imported litellm with noutilson its import path. On a managed cloud client that meant a remote cost-map fetch, measured at 3517 entries against the bundled 2982.LITELLM_LOG=ERRORis no longer stamped into the environment. It pinned litellm's stderr handler at ERROR for the whole process, disablinglitellm._turn_on_debug()for good, while the logger level was what actually gated the chatter. Output verified identical with and without it across plain, logging-configured, and debug hosts.The retry notice only fires when a retry follows (an off-by-one inherited from the old
print).Verification
pageindex.utilswas loaded before litellm's first import: managed-cloud and own-modelopenai_agent_configandanthropic_runner_config, the chat lane's model and protocol lookups, the thinking-budget ceiling, CLI token counting, andrun_pageindex.pyoffline. All report the local cost map. The remaining managed-cloud surfaces never import litellm at all.LITELLM_LOCAL_MODEL_COST_MAPwins from both the shell and.env.LITELLM_LOGvalues raise exactly as they did before.https://claude.ai/code/session_01CrSg9uRBvzVujNyU25Wmgk