litellm/cookbook
ryan-crabbe-berri 38f3f8a1a9
fix(proxy): cooldown errors carry 429, Sentry starts at boot without request bodies, tracing failures log at ERROR, exporter counters exported (#46344)
* fix(router): carry a 429 status on cooldown and no-deployment errors

RouterRateLimitError and RouterRateLimitErrorBasic had no status_code, so the
proxy answered an all-deployments-cooled-down request as a generic 500 class
error and logged the bug report notice for every cooldown. Both now carry
status_code 429, which the proxy maps to a rate_limit_error and which the
retry policy already treats as retryable

* fix(proxy): start Sentry at config load and never attach request bodies

Sentry only came up inside set_callbacks on the first LLM call, so boot and
background errors were never reported, and general_settings.alerting: [sentry]
always raised Missing SENTRY_DSN because the alerting path read a dead
litellm.utils pin instead of the live SDK. The proxy now initializes Sentry
once while loading the config whenever sentry is a configured callback or
alerting target, the alerting and failure handlers read the live instance, and
max_request_body_size is pinned to never so prompts and completions stay out
of Sentry events

* fix(tracing): log Lens failures at ERROR and export row counters to Prometheus

A tracing store that fails to start, or a Lens service that rejects a batch,
was only logged at WARNING, so operators running at the default ERROR level
never saw tracing silently go dark. Both now log at ERROR and name the lens
store. The exporter's rows_written and rows_dropped tallies were never
exported, so the two counts are now Prometheus counters
litellm_lens_export_rows_written_total and
litellm_lens_export_rows_dropped_total, registered lazily on the default
registry like the other proxy-level counters and charted on the all-metrics
Grafana dashboard

* test(proxy): drop the litellm import the alerting tests no longer use

* fix(proxy): start Sentry once a DSN is set, from any config source

Boot-time init used to lock Sentry in even with no SENTRY_DSN, so a DSN loaded later from DB environment_variables was never picked up. initialize_sentry now skips when no DSN is set and re-inits when the DSN changes. alerting_handler calls it too, so alerting: [sentry] set through the DB works. Drops the litellm_settings.callbacks check since that config fails to load with sentry in it

* fix(sentry): keep stack frame locals out of events unless PII is opted in

Frame locals carried prompts (messages, request bodies, provider options) into every error event. include_local_variables now follows SENTRY_SEND_DEFAULT_PII

* test(router): drop the test that only pinned the 429 class attribute

* fix(proxy): start Sentry at boot when it is only an input callback

* fix(proxy): keep Sentry init and alerting within the strict ruff and basedpyright ceilings

---------

Co-authored-by: yuneng-jiang <yuneng@berri.ai>
2026-10-16 00:53:52 +00:00
..
ai_coding_tool_guides fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
anthropic_agent_sdk fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
benchmark docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
codellama-server docs: remove phone numbers from readme and docs 2026-03-25 12:40:40 -07:00
community-resources (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
gollem_go_agent_framework chore(cookbook): bump Go directive to 1.26.3 in gollem example (#29234) 2026-05-28 18:12:31 -07:00
litellm-ollama-docker-image chore(deps): refresh dependency locks 2026-05-04 11:36:18 -07:00
litellm_proxy_server fix(proxy): cooldown errors carry 429, Sentry starts at boot without request bodies, tracing failures log at ERROR, exporter counters exported (#46344) 2026-10-16 00:53:52 +00:00
litellm_router (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
litellm_router_load_test fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
livekit_agent_sdk fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
logging_observability docs litellm x langfuse cookbook 2025-02-14 09:31:51 -08:00
misc fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
mock_guardrail_server Guardrails API - new structured_messages param (#17518) 2025-12-04 22:08:00 -08:00
mock_prompt_management_server fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
Benchmarking_LLMs_by_use_case.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
Claude_(Anthropic)_with_Streaming_liteLLM_Examples.ipynb (docs) update how to use litellm streaming 2023-11-21 11:19:32 -08:00
Evaluating_LLMs.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
google_adk_litellm_tutorial.ipynb [Docs] Using litellm with Google ADK (#10777) 2025-05-12 16:41:49 -07:00
liteLLM_A121_Jurrasic_example.ipynb add AI21 tutorial 2023-08-22 20:34:18 -07:00
LiteLLM_Azure_and_OpenAI_example.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
liteLLM_Baseten.ipynb Update Baseten LiteLLM integration 2025-08-19 12:21:05 -07:00
LiteLLM_batch_completion.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
LiteLLM_Bedrock.ipynb (docs) bedrock cookbook 2023-11-06 18:00:52 -08:00
liteLLM_clarifai_Demo.ipynb Clarifai - Added streaming and async completion support 2024-05-03 14:03:38 +00:00
LiteLLM_CometAPI.ipynb bump openai 2.8.0 2025-11-19 17:47:18 -08:00
LiteLLM_Comparing_LLMs.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
LiteLLM_Completion_Cost.ipynb add completion costs notebook 2023-09-06 18:43:09 -07:00
liteLLM_function_calling.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
liteLLM_Getting_Started.ipynb getting started cookbook litellm 2023-09-23 10:38:59 -07:00
LiteLLM_HuggingFace.ipynb fix img URL for tests 2025-11-22 09:41:15 -08:00
liteLLM_IBM_Watsonx.ipynb (docs) updated watsonx cookbook 2024-04-24 17:19:02 +02:00
liteLLM_Langchain_Demo.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
litellm_model_fallback.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
LiteLLM_NovitaAI_Cookbook.ipynb Add new model provider Novita AI (#7582) (#9527) 2025-05-12 21:49:30 -07:00
liteLLM_Ollama.ipynb docs 2023-09-21 12:33:39 -07:00
LiteLLM_OpenRouter.ipynb Add new model provider Novita AI (#7582) (#9527) 2025-05-12 21:49:30 -07:00
LiteLLM_Petals.ipynb cookbook petals 2023-09-20 09:34:33 -07:00
LiteLLM_PromptLayer.ipynb fix: prompt registry 2026-02-18 00:34:54 +05:30
liteLLM_Replicate_Demo.ipynb fix replicate docs 2023-09-06 12:35:50 -07:00
liteLLM_Streaming_Demo.ipynb add streaming example cookbook 2023-08-09 14:29:23 -07:00
litellm_test_multiple_llm_demo.ipynb Rename Untitled155.ipynb to litellm_test_multiple_llm_demo.ipynb 2023-08-10 18:56:26 -07:00
litellm_Test_Multiple_Providers.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
LiteLLM_User_Based_Rate_Limits.ipynb add notebook on using litellm budget manager 2023-09-12 20:53:55 -07:00
liteLLM_VertextAI_Example.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
Migrating_to_LiteLLM_Proxy_from_OpenAI_Azure_OpenAI.ipynb fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
mlflow_langchain_tracing_litellm_proxy.ipynb fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
nova_sonic_realtime.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
Parallel_function_calling.ipynb (docs) parallel function calling with Azure OpenAI 2023-11-18 14:36:56 -08:00
Proxy_Batch_Users.ipynb fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
result.html (docs) add embedding() profile 2023-11-30 19:04:51 -08:00
TogetherAI_liteLLM.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
Using_Nemo_Guardrails_with_LiteLLM_Server.ipynb (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
veo_video_generation.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
VLLM_Model_Testing.ipynb Add files via upload 2023-09-06 19:27:06 -07:00