litellm/litellm
ryan-crabbe-berri b86683679b
fix(vertex_ai): fail Gemini malformed replies with no output so retries and fallbacks run (#53231)
* test(vertex_ai): cover Gemini malformed replies with no output

A non-streaming Gemini reply that ends in MALFORMED_FUNCTION_CALL or MALFORMED_RESPONSE with no output comes back as a 200 stop with empty content, so retries and fallbacks never run. These tests expect a retriable 500 on chat completions, messages and responses, a fallback to the backup model, and billed tokens on the failure log, while replies with any output keep their 200.

* fix(vertex_ai): fail Gemini malformed replies with no output so retries run

When every Gemini candidate ends in MALFORMED_FUNCTION_CALL or MALFORMED_RESPONSE with no text, tool call, image or audio, raise a 500 that names the finish reason instead of returning a 200 stop with empty content. The failure log keeps the tokens Google billed. Replies with any output keep today's shape.

* fix(vertex_ai): keep Gemini pass-through spend logs and bill the failed attempt like other 200 errors

The malformed check now runs only on the live completion path, so the Gemini and Vertex pass-through loggers still bill a malformed reply instead of failing to log it. The failed attempt is recorded the same way OpenRouter records an error inside a 200, so a later retry or fallback can carry it. Tests now cover image, audio and legacy function-call output, the pass-through spend, and a smaller integration matrix on gemini-4-carbon.

* fix(vertex_ai): type the native finish reason read in the Gemini malformed check

* refactor(vertex_ai): return the Gemini malformed failure as a value and raise it at the request boundary

* fix(vertex_ai): keep token counts out of the Gemini malformed error so it is never remapped to a client error

The Vertex error mapper reads a bare 403 in the message as a permission error, so a reply that billed exactly 403 tokens would have skipped retries. The billed tokens stay on the spend log.
2026-11-21 09:49:27 -08:00
..
a2a_protocol refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
accounting feat(proxy): emit budget alerts for app customer scopes (#52955) 2026-11-19 16:21:09 -08:00
anthropic_interface refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
assistants refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
batch_completion refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
batches refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
caching refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +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 refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
completion_extras refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
compression refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
containers refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
decisions fix(decisions): accept OpenAI input_json content parts on /v1/decisions (#52805) 2026-11-20 13:33:36 -08:00
deploy feat(docker): install cryptography, grpcio and libpq from chainguard apks in the fips image (#52997) 2026-11-20 15:58:28 -08: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 fix(proxy): read audit update rows stored before #50929 in GET /audit (#53305) 2026-11-21 04:58:51 +00: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 refactor(vertex_ai): remove unreachable VertexAIFilesHandler.afile_content (#51966) 2026-11-15 13:54:05 -08:00
fine_tuning refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
google_genai refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
harness refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
images feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
integrations refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
interactions refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
litellm_core_utils refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
llms fix(vertex_ai): fail Gemini malformed replies with no output so retries and fallbacks run (#53231) 2026-11-21 09:49:27 -08:00
mcp_client fix(mcp): return an upstream -32042 URL elicitation error from /mcp as a JSON-RPC error (#52384) 2026-11-19 08:56:01 -08:00
messages feat(messages): serve bedrock claude_platform messages on rust only (#52681) 2026-11-19 14:34:02 -08:00
models refactor(budgets): use one budget window model for keys, teams, users and customers (#53218) 2026-11-20 16:17:05 -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 fix(packaging): ship the license public key in the litellm-proxy sdist (#52970) 2026-11-19 23:18:32 +00:00
passthrough refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
proxy refactor(auth-store): shape the cached virtual key in Rust and load it through one Python path (#53325) 2026-11-21 22:06:13 +09:00
proxy-extras fix(proxy): tolerate unavailable psycopg during migrations (#53146) 2026-11-20 11:29:41 -08:00
proxy_auth refactor(types): replace Any with real types across 29 more backend files 2026-09-08 10:14:07 +00:00
rag refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
realtime_api feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
redis refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
repositories refactor(auth-store): shape the cached virtual key in Rust and load it through one Python path (#53325) 2026-11-21 22:06:13 +09:00
rerank_api refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
responses refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
router_rust refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
router_strategy refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
router_utils fix(router): scope cooldown reads to request candidates (#52913) 2026-11-19 12:20:15 -08:00
runtime fix(gateway): honor the configured Postgres connection cap (#52729) 2026-11-19 04:10:10 +00:00
rust feat(gateway): answer a stream the provider fails before any content with a retry or a fallback (#52466) 2026-11-21 22:40:42 +09:00
rust_bridge refactor(auth-store): shape the cached virtual key in Rust and load it through one Python path (#53325) 2026-11-21 22:06:13 +09:00
sandbox refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
scripts feat(proxy): send gateway model calls to Lens as traces when the Lens store is connected (#53042) 2026-11-20 10:12:08 -08:00
search fix(tavily): price the search depth chosen automatically (#52564) 2026-11-18 13:04:12 -08:00
secret_managers refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
skills refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00: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 fix: keep LiteLLM-internal params out of provider request bodies (#46083) 2026-11-16 22:20:05 -08:00
types feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
ui feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08: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 refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +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(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
_internal_context.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00
_lazy_imports.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
_lazy_imports_registry.py fix(decisions): support the litellm_proxy provider (#51611) 2026-11-19 11:44:40 -08:00
_logging.py feat(control_plane): --control-plane flag serves the control plane API from the existing image (#49658) 2026-11-16 17:36:24 +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 fix(redis): drop ssl_ kwargs from the async pool when ssl is off (#52344) 2026-11-17 13:23:34 -08:00
_redis_credential_provider.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
_service_logger.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
_uuid.py fix: support Python 3.15 (#48359) 2026-10-26 16:00:11 +00:00
_version.py feat(sdk): build core from an independent packaging manifest (#44340) 2026-10-08 18:40:14 -07:00
anthropic_beta_gated_fields.py fix(anthropic)!: send extra_body fields at the top level of the Messages request (#48373) 2026-11-20 06:52:56 -08: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 fix(messages): load the anthropic beta map only when a filter has a beta to filter (#52188) 2026-11-16 20:03:08 -08: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 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
constants.py feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
cost.json
cost_calculator.py feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
exceptions.py feat(guardrails): hold streamed tool calls for the verdict and log prompts blocked with a reply (#51872) 2026-11-20 16:58:15 -08:00
guardrails.py Add guardrails.apply SDK helper (#49217) (#49469) 2026-10-31 23:37:45 +00:00
main.py feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
model_prices_and_context_window_backup.json feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
policy_templates_backup.json fix(packaging): keep wheel paths under Windows MAX_PATH for Store Python (#43903) 2026-09-30 22:20:36 +00:00
provider_endpoints_support_backup.json feat(provider)!: add ResetData and stop sending OPENAI_API_KEY to keyless JSON-configured providers (#50819) 2026-11-20 22:20:25 -08:00
py.typed
router.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00
router_api.py refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +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 refactor(router): delete router code nothing calls (#52516) 2026-11-19 06:11:10 +09: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 feat(router): queue congested provider requests by priority (#51892) 2026-11-17 21:26:21 -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 fix(customer-management)!: preserve permanent budgets across temporary increases (#52787) 2026-11-19 10:55:11 -08:00
setup_wizard.py fix(model_prices): correct Claude Sonnet 5.5 capabilities and provider keys (#43587) 2026-09-28 19:12:31 +00:00
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 refactor(typing): clear 1146 basedpyright Any errors across 365 files (#52768) 2026-11-21 04:25:33 +00:00