litellm/litellm
Cursor Agent 0220609ab6 Add validation and fallback protection for model cost map
This prevents upstream GitHub changes from breaking LLM calls by:

1. Runtime validation in get_model_cost_map.py:
   - Validates JSON structure before accepting remote data
   - Checks for required fields (litellm_provider)
   - Validates mode values against allowed list
   - Validates numeric cost fields
   - Falls back to local backup if validation fails
   - Logs warnings when falling back

2. Enhanced CI validation (.github/workflows/test-model-map.yaml):
   - JSON syntax validation (fast fail)
   - Comprehensive schema validation via Python script
   - Validates both main file and backup file
   - Checks backup freshness

3. New validation script (scripts/validate_model_cost_map.py):
   - Validates all entries have required fields
   - Checks mode values against allowed modes
   - Validates numeric fields are actually numeric
   - Sanity checks for suspiciously high costs
   - Detailed error reporting

4. Unit tests for validation logic

The key improvement: if GitHub returns valid JSON but semantically
broken data (missing fields, wrong types), we now detect this and
fall back to the local backup instead of using the bad data.

Customers can also set LITELLM_LOCAL_MODEL_COST_MAP=True to completely
disable remote fetching for maximum stability.

Co-authored-by: ishaan <ishaan@berri.ai>
2026-01-30 21:26:58 +00:00
..
a2a_protocol [Fix] A2a Gateway - Allow supporting old A2a card formats (#19949) 2026-01-28 15:02:08 -08:00
anthropic_interface [bug fix] do not fallback to token counter if disable_token_counter is enabled (#19041) 2026-01-13 16:53:38 -08:00
assistants
batch_completion
batches Merge pull request #19986 from BerriAI/litellm_batch_cost_tracking_jan29 2026-01-30 17:00:42 +05:30
caching Add support for caching for responses API 2026-01-14 13:33:07 +05:30
completion_extras Add routing of xai chat completions to responses when web search options is present 2026-01-30 14:15:35 +05:30
containers Make keepalive_timeout parameter work for Gunicorn (#19087) 2026-01-16 03:32:59 +05:30
endpoints/speech/speech_to_completion_bridge
experimental_mcp_client Merge branch 'main' into litellm_oss_staging_01_26_2026 2026-01-27 17:00:58 +05:30
files feat: add /delete endpoint support for gemini 2026-01-30 16:06:07 +05:30
fine_tuning
google_genai Add custom vertex ai mapping to the output 2026-01-22 15:18:24 +05:30
images Add None as default image value 2026-01-19 09:08:38 +05:30
integrations [Feat] Add async_post_call_response_headers_hook to CustomLogger (#20083) 2026-01-30 12:44:44 -08:00
interactions [Feat] Interactions API - allow using all litellm providers (interactions -> responses api bridge) (#18373) 2025-12-23 22:30:22 +05:30
litellm_core_utils Add validation and fallback protection for model cost map 2026-01-30 21:26:58 +00:00
llms Merge pull request #20058 from BerriAI/litellm_vertex_ai_prompt-caching-scope-2026-01-05, 2026-01-30 20:32:00 +05:30
ocr [Feat] /ocr - Add VertexAI OCR provider support + cost tracking (#16216) 2025-11-03 15:56:49 -08:00
passthrough [Fix] VertexAI Pass through - Ensure only anthropic betas are forwarded down to LLM API (#19542) 2026-01-21 19:12:04 -08:00
proxy [Feat] Add async_post_call_response_headers_hook to CustomLogger (#20083) 2026-01-30 12:44:44 -08:00
rag [Feat] RAG API - Add s3_vectors as provider on /vector_store/search API + UI for creating + PDF support for /rag/ingest (#19895) 2026-01-27 16:30:59 -08:00
realtime_api Fix: handling of model name in query param 2026-01-15 15:06:37 +05:30
rerank_api Add tests for header forwarding 2025-12-12 17:54:17 +05:30
responses fix(ResponseAPILoggingUtils): extract input tokens details as dict 2026-01-30 10:44:56 +07:00
router_strategy feat(tag-routing): support toggling tag matching between ANY and ALL (#18776) 2026-01-08 23:39:03 +05:30
router_utils Merge branch 'main' into litellm_oss_staging_01_28_2026 2026-01-29 17:39:42 +05:30
search [Bug Fix] Exa Search API - ensure request params are sent to Exa AI (#15855) 2025-10-23 11:56:30 -07:00
secret_managers fix: make HTTPHandler mockable in OIDC secret manager tests (#19803) 2026-01-26 11:00:42 -08:00
skills [Feat] Unified Skills API - works across Anthropic, Vertex, Azure, Bedrock (#18232) 2025-12-19 18:55:59 +05:30
types Merge pull request #20058 from BerriAI/litellm_vertex_ai_prompt-caching-scope-2026-01-05, 2026-01-30 20:32:00 +05:30
vector_store_files Vector store files Stable Release (#16643) 2025-11-15 13:00:33 -08:00
vector_stores Fix vector store configuration synchronization failure 2025-12-05 11:46:14 +05:30
videos fix: respect videos content db creds 2025-12-10 23:00:01 +05:30
__init__.py Merge pull request #20052 from BerriAI/litllm_disable_cache_jan_29 2026-01-30 17:01:34 +05:30
_lazy_imports.py refactor: migrate utils.py lazy imports to registry pattern (#18657) 2026-01-05 09:55:48 -08:00
_lazy_imports_registry.py fix(hosted_vllm): route through base_llm_http_handler to support ssl_verify (#19893) 2026-01-28 22:33:07 -08:00
_logging.py Fix: log duplication when json_logs is enabled (#19705) 2026-01-24 11:09:04 -08:00
_redis.py fix: Apply max_connections configuration to Redis async client (#15797) 2025-10-22 09:19:08 -07:00
_service_logger.py fix(langfuse_otel): ignore service logs and fix callback shadowing (#19298) 2026-01-19 05:53:47 -08:00
_uuid.py Fix: revert fastuuid optional dependency, always use fastuuid in .__uid helper (#14941) 2025-09-26 09:14:20 -07:00
_version.py
budget_manager.py
constants.py [Feat] New Model - amazon.nova-2-pro-preview-20251202-v1:0 (#20033) 2026-01-29 16:55:55 -08:00
cost.json
cost_calculator.py fix: token calculations and refactor (#19696) 2026-01-26 22:08:17 -08:00
exceptions.py Fix unsafe access to request attribute (#19573) 2026-01-22 10:58:29 -08:00
main.py Merge pull request #20051 from BerriAI/litellm_xai_web_search_routing 2026-01-30 17:01:19 +05:30
model_prices_and_context_window_backup.json [Feat] Add async_post_call_response_headers_hook to CustomLogger (#20083) 2026-01-30 12:44:44 -08:00
mypy.ini fix mypy 2025-09-27 12:21:32 -07:00
py.typed
router.py inspect BadRequestError after all other policy types (#19878) 2026-01-27 18:15:04 -08:00
scheduler.py Fix queue persistence to Redis (#19304) 2026-01-19 19:01:34 -08:00
timeout.py
utils.py Merge pull request #20052 from BerriAI/litllm_disable_cache_jan_29 2026-01-30 17:01:34 +05:30