litellm/litellm/litellm_core_utils
Krrish Dholakia 6809213957 feat(proxy): add project_alias tracking through callback metadata pipeline
Thread project_alias alongside project_id through the metadata pipeline so
callbacks receive the human-readable project name. DRY up duplicate metadata
dict construction in proxy_track_cost_callback and pass_through_endpoints by
reusing get_sanitized_user_information_from_key — future metadata fields only
need adding in one place.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 10:44:17 -07:00
..
audio_utils style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
llm_cost_calc style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
llm_response_utils style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
prompt_templates Merge remote-tracking branch 'origin/main' into litellm_dev_sameer_16_march_week 2026-03-21 15:11:29 -07:00
specialty_caches
tokenizers
api_route_to_call_types.py Agent Guardrails - on streaming output (#21206) 2026-02-14 11:36:52 -08:00
app_crypto.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
asyncify.py
cached_imports.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
cli_token_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
core_helpers.py Merge pull request #23899 from Chesars/fix/map-anthropic-refusal-finish-reason 2026-03-17 18:49:03 -03:00
coroutine_checker.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
credential_accessor.py
custom_logger_registry.py Add Vantage integration for FOCUS CSV export 2026-03-11 13:51:36 +05:30
dd_tracing.py _add_dd_apm_tags_for_litellm_call_id (#22219) 2026-02-26 16:42:23 -08:00
default_encoding.py [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
dot_notation_indexing.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
duration_parser.py Reapply "feat: add model_cost aliases expansion support" 2026-03-12 13:36:57 -03:00
env_utils.py fix(callbacks): allow MAX_CALLBACKS override via env var (#20781) 2026-02-09 12:11:32 -08:00
exception_mapping_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
fallback_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
get_blog_posts.py fix: remove unused Any import from get_blog_posts 2026-03-16 16:23:06 -07:00
get_litellm_params.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
get_llm_provider_logic.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
get_model_cost_map.py style: run black formatter on 52 non-enterprise files 2026-03-12 14:23:50 -03:00
get_provider_specific_headers.py
get_supported_openai_params.py merge: resolve conflicts between main and litellm_oss_staging_03_11_2026 2026-03-12 09:38:31 -03:00
health_check_helpers.py add docs and formatting 2026-02-28 14:08:09 +05:30
health_check_utils.py
initialize_dynamic_callback_params.py Fix test_global_redaction_off_with_dynamic_params 2026-02-05 18:26:03 +05:30
json_validation_rule.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
litellm_logging.py feat(proxy): add project_alias tracking through callback metadata pipeline 2026-03-23 10:44:17 -07:00
llm_request_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
logging_callback_manager.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
logging_utils.py fix(types): resolve MyPy assignment type errors in logging_utils and vertex transformation 2026-02-20 13:46:51 -03:00
logging_worker.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
mock_functions.py
model_param_helper.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
model_response_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
README.md
realtime_streaming.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
redact_messages.py Reapply "feat: add model_cost aliases expansion support" 2026-03-12 13:36:57 -03:00
response_header_helpers.py
rules.py
safe_json_dumps.py fix: shared health check serialization (#21119) 2026-02-13 09:15:43 -08:00
safe_json_loads.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
sensitive_data_masker.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
streaming_chunk_builder_utils.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
streaming_handler.py Litellm ishaan march 20 (#24303) 2026-03-21 12:40:11 -07:00
thread_pool_executor.py
token_counter.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00

Folder Contents

This folder contains general-purpose utilities that are used in multiple places in the codebase.

Core files:

  • streaming_handler.py: The core streaming logic + streaming related helper utils
  • core_helpers.py: code used in types/ - e.g. map_finish_reason.
  • exception_mapping_utils.py: utils for mapping exceptions to openai-compatible error types.
  • default_encoding.py: code for loading the default encoding (tiktoken)
  • get_llm_provider_logic.py: code for inferring the LLM provider from a given model name.
  • duration_parser.py: code for parsing durations - e.g. "1d", "1mo", "10s"
  • api_route_to_call_types.py: mapping of API routes to their corresponding CallTypes (e.g., /chat/completions -> [acompletion, completion])