litellm/litellm
joshua-berri d723545320
fix(otel): report the provider model in experimental GenAI traces (#51430)
* fix(otel): report the provider's response model under gen_ai_latest_experimental

With OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental, gen_ai.response.model now uses
the provider_response_model kept on the response hidden params, then the deployment model when
the response only echoes the client alias. Legacy mode and litellm.model_group keep the alias.

Fixes #51029

* fix(otel): type the semconv response model inputs and attach hidden params in tests

Bind the request model once through as_str so the deployment fallback no longer reads untyped
kwargs. Non-streamed fixtures now attach provider_response_model with set_hidden_params, since
ModelResponse(hidden_params=...) does not keep it on the pydantic private attribute.

* fix(otel): read the request model as object before narrowing it

Binding kwargs.get("model") to a Final[object] stops basedpyright from reporting an unknown
argument passed to as_str.

* fix(otel): validate the untyped request model through a TypeAdapter boundary

TypeAdapter(object).validate_python accepts the untyped kwargs value and returns a known object,
the existing litellm/utils.py and router.py pattern, so as_str no longer receives an Unknown.

* test(otel): stream the aliased response through a real Logging object

Greptile flagged the MagicMock logging_obj as a double on our own code. The streamed fixture now
builds a real Logging with a fixed start time, like test_streaming_handler.py.

---------

Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com>
2026-11-12 10:45:56 -08:00
..
a2a_protocol refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
accounting feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
anthropic_interface feat(anthropic): forward message threads on native /v1/messages (#50976) 2026-11-10 18:33:54 -08:00
assistants refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
batch_completion
batches refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
caching feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
chat_completions fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
cli chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
completion_extras fix(tool_choice): accept the Responses API's flat allowed_tools layout on chat completions (#50467) 2026-11-10 13:04:06 -08:00
compression
containers feat(openai)!: honor per-deployment workload identity on non-chat routes (#39966) 2026-10-16 22:25:15 +00:00
decisions feat(gemini): support gemini-decision-1 on /v1/decisions and /v1/systemone (#51220) 2026-11-11 18:33:22 -08:00
deploy chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
embeddings fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
endpoints/speech/speech_to_completion_bridge feat(accounting): capture request usage through the durable meter (#49133) 2026-10-31 07:32:25 -07:00
enterprise feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
evals
experimental_mcp_client refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
extraction feat(extraction): add /v1/extraction with Cloudflare Clairic support (#47473) 2026-10-20 15:51:45 -07:00
files feat(gemini): file-backed batch jobs on /v1/batches with output download and spend tracking (#51032) 2026-11-11 12:00:32 -08:00
fine_tuning fix(managed_files): send provider file ids when creating a fine-tuning job from managed files (#46552) 2026-10-19 14:40:15 -07:00
google_genai refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
harness refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
images feat(replicate): add video generation, image generation and text to speech through the predictions API (#51360) 2026-11-12 08:44:50 -08:00
integrations fix(otel): report the provider model in experimental GenAI traces (#51430) 2026-11-12 10:45:56 -08:00
interactions refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
litellm_core_utils fix(spend-logs): mask token-shaped secrets in stored request and resp… (#48968) 2026-11-12 18:45:06 +00:00
llms feat(fal_ai): add Nano Banana 2.1, bill it from fal billable units, fix google/ routing (#51410) 2026-11-12 08:55:08 -08:00
mcp_client feat(mcp): cache upstream tool lists with an admin-set lifetime (#51160) 2026-11-12 08:48:04 -08:00
messages feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
models feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
ocr fix(rust): run native async calls through python's async wrapper steps (#50423) 2026-11-10 00:24:20 +00:00
packaging chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
passthrough refactor: remove redundant comments from fresh changes (#51163) 2026-11-11 09:18:18 -08:00
proxy fix(spend-logs): mask token-shaped secrets in stored request and resp… (#48968) 2026-11-12 18:45:06 +00:00
proxy-extras chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
proxy_auth
rag refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
realtime_api refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
redis fix(proxy): show committed spend in the remaining budget gauges (#49199) 2026-11-09 20:05:37 +00:00
repositories feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
rerank_api refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
responses fix(responses): keep reasoning item IDs consistent across streaming events (#51243) 2026-11-11 15:49:46 -08:00
router_rust chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
router_strategy refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
router_utils refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
runtime chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
rust feat(model-catalog): read output_cost_per_billable_unit in the rust registry check (#51365) 2026-11-12 07:59:03 -08:00
rust_bridge fix(messages): name the deployment on a rust stream's transport error (#51358) 2026-11-12 17:29:37 +00:00
sandbox refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
scripts chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
search fix(search): price Tavily advanced and Linkup deep searches at their own cost map entries (#47411) 2026-10-19 23:32:31 -07:00
secret_managers refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
skills refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
systemone fix(decisions): log every request field the caller sent on /v1/systemone and /v1/decisions (#47183) 2026-10-19 14:19:14 -07:00
telemetry refactor: clean up fresh tech debt in per-user Copilot auth, Ternary FOCUS export and telemetry (#45769) 2026-10-15 04:29:27 +00:00
text_completions refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
tracing chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
types feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
ui fix(spend-logs): mask token-shaped secrets in stored request and resp… (#48968) 2026-11-12 18:45:06 +00:00
vector_store_files fix(secret_managers)!: resolve oidc/file and oidc/env refs in admin-configured api_key per request (#47341) 2026-10-20 01:43:59 +00:00
vector_stores feat(bedrock): search knowledge bases by image and return image hits (#51063) 2026-11-12 00:19:34 +00:00
videos refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
vscode-extension chore: move ui and vscode-extension under litellm and delete docs (#50992) 2026-11-12 04:19:57 +00:00
__init__.py feat(gemini): support gemini-decision-1 on /v1/decisions and /v1/systemone (#51220) 2026-11-11 18:33:22 -08:00
_internal_context.py fix(chatgpt): round-trip encrypted reasoning through /v1/messages (#49076) 2026-11-07 11:32:59 -08:00
_lazy_imports.py refactor: read lazy attributes with getattr instead of a TypedDict wrapper (#50543) 2026-11-07 10:56:30 -08:00
_lazy_imports_registry.py feat(gemini): support gemini-decision-1 on /v1/decisions and /v1/systemone (#51220) 2026-11-11 18:33:22 -08:00
_logging.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
_process_defaults.py perf(cli): start lite without initializing the litellm SDK (#46803) 2026-10-17 04:53:32 +00:00
_redis.py feat(redis): serve the proxy's common Redis call with Rust stores (#50170) 2026-11-06 06:01:11 +00:00
_redis_credential_provider.py
_service_logger.py fix(caching): report Redis circuit-breaker metrics through the Prometheus services logger (#46484) 2026-10-14 14:29:54 -07:00
_uuid.py fix: support Python 3.15 (#48359) 2026-10-26 16:00:11 +00:00
_version.py
anthropic_beta_gated_fields.py fix(anthropic)!: drop beta-gated body fields under drop_params (#48793) 2026-10-29 06:25:31 -07:00
anthropic_beta_headers_config.json fix(bedrock): forward the compact-2026-09-04 compaction param on Invoke /v1/messages (#51223) 2026-11-11 15:10:32 -08:00
anthropic_beta_headers_manager.py feat(messages): serve anthropic messages on rust only (#51119) 2026-11-12 00:07:20 +00:00
blog_posts.json chore(blog): refresh the bundled blog posts backup with the latest 50 posts from the docs RSS feed (#49971) 2026-11-03 23:41:15 +00:00
budget_manager.py refactor(typing): clear 1143 basedpyright Any errors across 273 files (#46574) 2026-10-15 21:08:47 +00:00
constants.py feat(replicate): add video generation, image generation and text to speech through the predictions API (#51360) 2026-11-12 08:44:50 -08:00
cost.json
cost_calculator.py feat(bedrock): search knowledge bases by image and return image hits (#51063) 2026-11-12 00:19:34 +00:00
exceptions.py fix(proxy): name the deployment in stream error alerts on chat, completions, responses and messages (#51034) 2026-11-11 22:50:23 +00:00
guardrails.py Add guardrails.apply SDK helper (#49217) (#49469) 2026-10-31 23:37:45 +00:00
main.py feat(replicate): add video generation, image generation and text to speech through the predictions API (#51360) 2026-11-12 08:44:50 -08:00
model_prices_and_context_window_backup.json feat(vertex_ai): add vertex_ai/gemini-4-hydrogen from the Vertex pricing page (#51432) 2026-11-12 18:34:07 +00:00
policy_templates_backup.json
provider_endpoints_support_backup.json chore(pricing): sync replicate model prices from replicate.com model pages (#51067) 2026-11-11 01:07:16 +00:00
py.typed
router.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
router_api.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
router_attempt.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
router_config.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
router_core.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
router_deprecated.py fix(router): re-check and reserve per-model rate limits on fallback targets (#50994) 2026-11-10 16:36:10 -08:00
router_host.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
router_python_host.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
scheduler.py fix(scheduler): read shared queue from Redis so expired dead-replica entries stop blocking waiters (#49387) 2026-10-31 11:43:46 -07:00
schema.prisma chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
setup_wizard.py
timeout.py
tool_loop.py fix(tool_choice): accept the Responses API's flat allowed_tools layout on chat completions (#50467) 2026-11-10 13:04:06 -08:00
utils.py feat(fal_ai): add Nano Banana 2.1, bill it from fal billable units, fix google/ routing (#51410) 2026-11-12 08:55:08 -08:00