litellm/tests/test_litellm/llms
ishaan-berri dabf43b594
fix: completion_cost AttributeError on streaming Anthropic web_search responses (#26153) (#27346)
* fix: coerce server_tool_use dict to ServerToolUse in Usage.__init__ (#26153)

* fix: coerce server_tool_use to ServerToolUse in stream_chunk_builder (#26153)

* fix: dict/pydantic-tolerant access in tool_call_cost_tracking (#26153)

* fix: dict/pydantic-tolerant access in anthropic cost_calculation (#26153)

* test: assert ServerToolUse type in existing stream_chunk_builder anthropic web search test

* test: regression test for #26153 (stream_chunk_builder server_tool_use type)

* test: dict/pydantic safety for tool_call_cost_tracking helper

* test: dict/pydantic safety for anthropic web_search cost

* refactor: consolidate _get_web_search_requests into shared cost-calc utils

* test(realtime): use gpt-realtime; openai retired gpt-4o-realtime-preview

OpenAI shut down the gpt-4o-realtime-preview family (incl. the undated
alias) on 2026-05-07, causing the live realtime test to fail with a
4000 invalid_request_error.invalid_model close. gpt-realtime is the GA
successor; switch the live-call tests to it, matching the base branch.

* refactor(types): drop redundant server_tool_use coercion in Usage.__init__

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
(cherry picked from commit 4a3860df1f)

[backport note -- stable/1.87.x] Aggregator-provenance pick, user-approved: #27346's
content reached litellm_internal_staging only via the squashed OSS sync (#29932 /
32c88ca74f), so merge 4a3860df1f is not an ancestor of staging tip; its post-image is
content-identical to staging. Also restored the 2-line server_tool_use dict->ServerToolUse
coercion in litellm/types/utils.py: it is #27346's own first commit, dropped from the squash
("refactor(types): drop redundant server_tool_use coercion") only because staging already
carried it via the OSS sync. 1.87.x predates that, and #31035's usage-only fallback needs it.
Mirrors the stable/1.88.x precedent (24b9655cd4).
2026-06-23 21:16:05 -07:00
..
amazon_nova/chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
anthropic fix: completion_cost AttributeError on streaming Anthropic web_search responses (#26153) (#27346) 2026-06-23 21:16:05 -07:00
azure fix(azure): preserve AD token refresh in v1 OpenAI client path (#28627) 2026-06-03 22:53:44 +00:00
azure_ai refactor: remove unnecessary comments from #27074 2026-05-04 19:34:56 +00:00
base_llm fix(proxy): normalize managed resource team owner field 2026-05-04 17:05:50 -07:00
baseten/chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
bedrock Add Claude Fable 5 across Anthropic, Bedrock, Vertex AI, and Azure AI (#30064) 2026-06-10 18:20:42 +00:00
bedrock_mantle feat(bedrock_mantle): add SigV4/IAM auth to Responses API route (#29788) 2026-06-11 03:03:39 +00:00
black_forest_labs style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
bytez/chat fix: preserve safe provider model path segments 2026-04-29 22:09:54 -07:00
chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
chatgpt Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
cloudflare fix: preserve safe provider model path segments 2026-04-29 22:09:54 -07:00
cohere style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
cometapi/chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
compactifai style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
crusoe fix(crusoe): remove trailing slashes from API base URLs and fix list indentation 2026-05-01 17:27:52 +05:30
custom_httpx feat(bedrock_mantle): add SigV4/IAM auth to Responses API route (#29788) 2026-06-11 03:03:39 +00:00
dashscope Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
databricks style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
datarobot style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
deepgram style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
deepinfra style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
deepseek fix(deepseek): use native /anthropic/v1/messages endpoint and sanitize tools (#28200) 2026-05-18 18:14:13 -07:00
docker_model_runner style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
elevenlabs test: avoid provider test module name collision 2026-04-29 22:36:57 -07:00
featherless_ai/chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
fireworks_ai Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
gemini test: document gemini file URI handling 2026-04-29 22:38:56 -07:00
github_copilot fix black and github mock test 2026-05-11 20:41:10 +05:30
heroku style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
hosted_vllm fix(hosted_vllm): normalize custom tools for chat completions (#25763) 2026-05-05 17:27:02 -07:00
huggingface style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
jina_ai/embedding feat(JinaAI): support multimodal embedding models (#13181) 2025-08-05 19:21:56 -07:00
lemonade style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
litellm_proxy chore: simplify ownership tracking — drop thin stores, in-memory fallback, hand-rolled cache 2026-05-05 00:23:32 +00:00
llamafile/chat style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
lm_studio style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
manus fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
meta_llama fix: add missing OpenAI chat completion params to OPENAI_CHAT_COMPLETION_PARAMS (#21360) 2026-02-16 20:31:21 -08:00
minimax style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
mistral Merge pull request #25256 from BerriAI/litellm_ishaan_april6 2026-04-17 16:26:45 -07:00
moonshot add moonshot/kimi-k2.6 to model registry (#26203) 2026-04-21 19:58:43 -07:00
nebius test: fixes 2025-05-31 12:42:56 -07:00
novita/chat
nscale/chat
nvidia_riva feat(audio_transcription): add NVIDIA Riva STT provider (#27185) 2026-05-05 17:17:51 -07:00
oci CI: copy of #25177 (OCI GenAI: embeddings, streaming/reasoning fixes, model catalog) (#28223) 2026-05-23 12:15:41 -07:00
ocr Add OCR guardrail_translation handler and support (#22145) 2026-02-28 17:39:36 -08:00
ollama Litellm agent oss staging 05 11 2026 (#27733) 2026-05-13 14:09:12 -07:00
openai fix: stop use_chat_completions_api flag from leaking into provider request body (#29447) 2026-06-20 11:53:49 -07:00
openai_like style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
openrouter style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
ovhcloud fix(ovhcloud): remove dead transform_response override 2026-04-28 23:09:17 +05:30
perplexity style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
pg_vector/vector_stores fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
publicai style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
ragflow/chat fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
recraft style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
reducto Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
runwayml fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
s3_vectors Fix extra body error 2026-04-29 08:34:31 +05:30
sagemaker fix(sagemaker): send native Cohere embed payload to Cohere SageMaker endpoints (#28613) 2026-05-22 12:00:42 -07:00
sambanova Feat/sambanova embeddings (#13308) 2025-08-12 17:15:26 -07:00
sap style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
scaleway Feature/add audio support for scaleway (#26110) 2026-04-20 14:49:41 -07:00
snowflake style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
stability style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vercel_ai_gateway style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vertex_ai fix(vertex): strip output_config.effort for Vertex Claude models that reject it (Haiku 4.5) (#29585) 2026-06-03 22:53:45 +00:00
volcengine fix: encode upstream URL path identifiers 2026-04-29 22:02:39 -07:00
voyage/rerank style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
wandb (feat): Add W&B Inference to LiteLLM 2025-09-11 00:07:30 +05:30
watsonx style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
xai Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
zai style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_cache_control_and_reasoning.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_file_content_block.py Litellm oss staging (#28161) 2026-05-18 16:27:44 -07:00
test_file_search_responses.py fix(tests): use canonical litellm_enterprise import path (#27699) 2026-05-12 12:32:57 -07:00
test_lifecycle_fix.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_oom_fixes.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_polling_url_origin_match.py chore(security): close two unaddressed SSRF cases 2026-05-01 18:43:47 +00:00
test_predibase_transformation.py refactor(predibase): migrate transform_request and transform_response… (#25249) 2026-04-27 08:58:22 +05:30