Commit graph

2798 commits

Author SHA1 Message Date
Mateo Wang
bf51dea36b
Merge pull request #39862 from BerriAI/litellm_lit_6992_cohere_parse
feat(ocr): add Cohere Parse support for cohere and azure_ai
2026-09-05 15:16:16 -07:00
devin-ai-integration[bot]
4df284e16d
fix(guardrails): record guardrail information for undecorated custom apply_guardrail overrides (#39727)
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-05 11:39:24 -07:00
mateo-berri
004a820116 fix(ocr): send each provider a health-check document it accepts
Health checks probed every OCR deployment with a PDF, which Cohere Parse
rejects, so /health, background health checks, and the UI Test Connection
button marked Cohere Parse deployments unhealthy. BaseOCRConfig gains a
get_health_check_document hook (PDF by default) that CohereParseConfig
overrides with a 1x1 PNG data URI. cohere also gains ocr in the provider
endpoint matrix
2026-09-04 22:52:12 -07:00
tin-berri
78ad88f52c
fix(responses): decode JSON-string tool schemas before sending to the provider (#39844)
* fix(responses): decode JSON-string tool schemas before sending to the provider

A caller that hands a tool schema over already JSON-encoded reached the
Responses API with a string `parameters`, and the provider rejected the
request with a 400 naming the routed model instead of the offending tool.
Decode it at the one place every Responses request converges, and refuse
anything that is neither an object nor a string encoding one.

Collapses the duplicated input/tool sanitization block shared by the
request and compact-request builders into a single owner, so the decode
cannot be wired into one path and not the other.

* test(responses): pin null tool schemas as accepted, and type the parametrized cases

The Responses API serves `parameters: null` and an omitted schema alike, so
neither may raise. Pin both against a future tightening, annotate the
parametrized inputs, and trim the docstrings back to what the code does not
already say.
2026-09-05 05:14:44 +00:00
mateo-berri
d3a179f988 fix(azure_ai): route only cohere parse deployment names to Cohere Parse 2026-09-04 22:07:26 -07:00
mateo-berri
8426235290 feat(ocr): add Cohere Parse support for cohere and azure_ai 2026-09-04 21:25:46 -07:00
Mateo Wang
2f90a264f6
Merge pull request #39827 from BerriAI/litellm_azure_gpt_6_astra
feat(cost-map): add azure/gpt-6-astra and azure/us/gpt-6-astra Foundry pricing
2026-09-04 18:48:51 -07:00
yucheng-berri
853fed824e
fix(bedrock): stop sending toolConfig tool definitions to guardrails on passthrough converse (#39281)
Bedrock passthrough Converse routes flattened every non-empty string under
toolConfig.tools into the guardrail INPUT texts, so tool names, tool
descriptions and JSON-schema strings (object, property names, titles, type
names, enum values) each arrived as a separate guardrail item. A request whose
only prompt was one benign user message could be blocked outright because a
denied term appeared in an app-authored tool definition.

Tool definitions are now excluded from the extracted texts, matching every
other guardrail translation handler, which carries tool definitions in the
structured tools input rather than in texts. Caller content stays scanned:
message text, toolUse.input, toolResult content and json, and
additionalModelRequestFields are unchanged.

Resolves LIT-5797
2026-09-04 18:40:35 -07:00
Mateo Wang
41c8c2f410
Merge pull request #39763 from BerriAI/litellm_fireworks_tool_choice_short_name
fix(fireworks_ai): resolve tool_choice and reasoning support for short model names
2026-09-04 18:22:25 -07:00
yuneng-jiang
e733ca1065
Merge pull request #39811 from BerriAI/litellm_/mongodb-vector-store-e4ff63
feat(vector_stores): add a MongoDB vector store provider for Atlas and self-managed deployments
2026-09-04 18:19:03 -07:00
mateo-berri
c02f198a4a fix(azure): responses none-effort temperature gate reads the azure/ cost-map entry 2026-09-04 17:45:06 -07:00
mateo-berri
51514b9123 fix(cost-map): azure/gpt-6-astra accepts reasoning_effort none on Foundry 2026-09-04 17:29:55 -07:00
moe-berri
aa3d59d086
fix(anthropic): never carry cache_control on translated thinking blocks (#39815)
* fix(anthropic): never carry cache_control on translated thinking blocks

The /v1/messages adapter built every thinking and redacted_thinking block with
cache_control=content.get("cache_control", {}), so a block the client never
marked still came out carrying an empty cache_control. anthropic_messages_pt
replays thinking blocks verbatim and first, so that value landed at content[0]
of the outbound assistant message and Anthropic rejected the request with
messages.N.content.0.thinking.cache_control: Extra inputs are not permitted.

Anthropic's schema has no cache_control on either block type, so there is
nothing to gate or translate here, only to stop copying. Every sibling block
type already routes through _add_cache_control_if_applicable; these two were
the only ones setting the key unconditionally.

This is reachable from any caller that round-trips Anthropic messages through
the OpenAI shape, which is why shadow eval saw it on a majority of sampled
Claude Code turns while the same traffic served natively was fine.

* test(anthropic): assert the outbound wire body for redacted thinking blocks
2026-09-04 17:18:59 -07:00
Yuneng Jiang
2a11c2747f fix(vector_stores): serialize the MongoDB client cache so concurrent searches cannot trip over an eviction
Async searches reach the sync client through executor threads, so the LRU cache
is shared state. A key could be evicted between the lookup and the reordering
that followed it, and the reordering then raised KeyError and became a 500.

Reproduced at 15 failures per run with 16 threads over 34 keys and a 1ns switch
interval; the regression test is that workload.
2026-09-04 15:25:38 -07:00
Yuneng Jiang
da58c0c6d5 fix(vector_stores): keep a lost MongoDB connection retryable and bound the client cache by use
litellm only retries 408, 409, 429 and 5xx, so classifying a dropped connection
as a 400 turned one replica set failover into a permanently failed search. It is
a 503 now, with the message still naming the misconfigurations that also close a
connection.

The client cache skipped insertion once it held 32 entries, so any store added
after that rebuilt its client on every search, paying an SRV lookup, a TLS
handshake and topology discovery each time. It evicts the least recently used
entry instead, which only drops the cache's own reference.

Also trims the explanatory comments to the one-line form the repo asks for.
2026-09-04 15:08:37 -07:00
Mateo Wang
922659fb15
Merge pull request #39388 from BerriAI/litellm_registry_audit_2026_09_02
fix(model_prices): verified registry audit, Databricks Sep-2026 catalog, realtime image pricing, deprecation dates
2026-09-04 14:51:40 -07:00
Yuneng Jiang
4774a426c5 refactor(vector_stores): route MongoDB query embeddings through the shared executor
The base vector store interface grew an embedding_executor argument, and
litellm.vector_stores.search now always passes one. MongoDB still carried its
own embedding_fn/aembedding_fn constructor seam, so every search through the
public entry point failed with an unexpected keyword argument.

Drop the local seam in favour of the shared executor: one path instead of two,
and the unit tests now drive the same seam production uses.
2026-09-04 14:20:28 -07:00
Yuneng Jiang
431579dc16
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_/mongodb-vector-store-e4ff63
# Conflicts:
#	.github/workflows/_test-unit-base.yml
#	litellm/litellm_core_utils/sensitive_data_masker.py
#	tests/test_litellm/litellm_core_utils/test_sensitive_data_masker.py
#	uv.lock
2026-09-04 14:00:10 -07:00
Yuneng Jiang
323f51269d
fix(vector_stores): return 400 when a MongoDB TLS file cannot be read
tlsCAFile and tlsCertificateKeyFile are how a self-managed deployment presents a
private CA, so they are the options on-prem operators actually set. pymongo opens
those files itself during TLS setup and lets OSError out, which is neither a
PyMongoError nor a ValueError, so it missed every branch of the translator and
litellm.exception_type turned it into a 500 with a traceback in the body. A
mistyped path, or one that exists on the host but not inside the container, is a
routine mistake and has to read as a 400 naming the file.

Matched on the exception carrying a filename so a socket-level OSError still falls
through to the branches that handle it. Verified against a self-managed mongod with
a missing CA file, a CA path that is a directory, and a missing client certificate.
2026-09-04 13:59:07 -07:00
Mateo Wang
300d335255
Merge pull request #39361 from BerriAI/litellm_fix_mantle_host_re_anchor
fix(bedrock_mantle): anchor MANTLE_HOST_RE so custom Mantle hosts are honored
2026-09-04 13:40:02 -07:00
Yuneng Jiang
50fb35e17e
fix(vector_stores): make MongoDB errors actionable on self-managed deployments
mongod serves $vectorSearch identically whether mongot runs under Atlas or beside
a self-managed deployment, so the provider already worked against on-prem. The
guidance did not: a refused connection told the operator to check their project's
IP access list and whether the cluster was paused, neither of which exists outside
Atlas, and the index errors claimed an "Atlas Vector Search index" they do not have.
Every message now names a remedy for both, keeping the Atlas-specific hint labelled
as such.

Also diagnoses unescaped credentials, which self-managed deployments hit more often
because the password is usually generated. pymongo reports those three different
ways and none of them mentions the password: '@', ':' and '%' raise an RFC 3986
complaint, '/' is read as the database separator and surfaces as Bad database name,
and an unescaped ':' looks like a bad port and comes back as a plain ValueError.
All three now point at the credentials. The ValueError branch's comment claimed it
fired on an unescaped '/', which pymongo actually reports as InvalidURI; corrected
to the port parse it really catches.

Verified against a self-managed mongod 8.0 with mongot, reached over plain
mongodb:// with no SRV and no TLS: 13 cases with live OpenAI embeddings, and 4
credential cases against an auth-enabled instance whose password holds % @ / and :.
list_search_indexes returns the same queryable and status fields there as on Atlas,
so the index-readiness check needed no change.
2026-09-04 13:39:54 -07:00
Mateo Wang
338a37d8cd
Merge pull request #39632 from BerriAI/litellm_lit6874_fireworks_perplexity_off_peak_pricing
fix(cost): honor off_peak_pricing in the fireworks_ai and perplexity cost calculators
2026-09-04 13:20:52 -07:00
Mateo Wang
44b1cc7b0f
Merge pull request #39589 from BerriAI/litellm_fix_v1_messages_midstream_timeout_failure_logging
fix(proxy): log mid-stream /v1/messages failures as failures with partial usage
2026-09-04 13:20:30 -07:00
mateo
93abc3a0cd Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_registry_audit_2026_09_02 2026-09-04 19:02:44 +00:00
Krrish Dholakia
2f1da035ae fix(fireworks_ai): keep generic capability fallback for reasoning and tool_choice
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-04 17:06:01 +00:00
Krrish Dholakia
788efea7b3 fix(fireworks_ai): resolve tool_choice/reasoning support for short model names
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-04 16:25:15 +00:00
Yujong Lee
fae3d224eb Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_python_version_ci
# Conflicts:
#	basedpyright-code-budget.json
#	tests/sdk_function_trace/profiler.py
#	tests/sdk_function_trace/test_profiler.py
2026-09-04 09:01:13 -07:00
mateo
8e83d6d63d fix(model_prices): add Databricks Sep-2026 catalog, Azure gpt-realtime-2.x, per-token realtime image pricing
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-04 14:06:54 +00:00
mateo
08bfdadb10 chore: merge litellm_internal_staging into litellm_registry_audit_2026_09_02, drop the deleted ocr ledger
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-04 04:18:09 +00:00
mateo-berri
2f3d1ca575 Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_fix_v1_messages_midstream_timeout_failure_logging
# Conflicts:
#	litellm/litellm_core_utils/litellm_logging.py
2026-09-03 18:27:43 -07:00
tin-berri
bd10977a9a
fix(snowflake): normalize Cortex Claude request shapes (#39453)
* fix(snowflake): normalize Cortex Claude request shapes

Co-authored-by: Kamron Javaherpour <kamron@kargo.com>

Co-authored-by: Oleksandr Kononov <oleks.konov@kargo.com>

* style(snowflake): format Cortex request transformations

* fix(snowflake): annotate Cortex wire payloads

* fix(snowflake): route Cortex content through the shared Anthropic converters

* fix(snowflake): surface Cortex prompt-cache usage and thinking blocks

Parse Cortex's Anthropic-dialect responses and SSE with Anthropic's own parser so cache_creation/cache_read counts, thinking blocks and signatures reach the caller. Restore thinking for every Claude model: Cortex documents extended thinking broadly and only adaptive thinking is 4.6-gated.

* fix(snowflake): echo signed thinking blocks on every assistant turn

The reference converter extends signed thinking blocks on each assistant turn, not just tool-call turns, so a replayed thinking-plus-text response keeps its signed block. Content-less thinking turns send no empty text block.

* fix(snowflake): preserve thinking list content

---------

Co-authored-by: Oleksandr Kononov <oleks.konov@kargo.com>
2026-09-03 17:44:07 -07:00
mateo-berri
edea0eeb15 Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_fix_v1_messages_midstream_timeout_failure_logging 2026-09-03 16:42:10 -07:00
mateo-berri
fde676dc38 fix(anthropic): run the proxy failure hook when a detached /v1/messages stream fails 2026-09-03 16:42:08 -07:00
mateo-berri
656d81e84d Merge origin/litellm_internal_staging into litellm_lit6874_fireworks_perplexity_off_peak_pricing
Adapts both calculators to the TokenRates signature apply_off_peak_pricing took in #39635
2026-09-03 16:22:44 -07:00
Mateo Wang
a3afbb17e0
Merge pull request #39652 from BerriAI/litellm_fix_openai_wif_openai_backed_hosts
fix(openai): mint workload identity tokens for PrivateLink and regional api.openai.com hosts
2026-09-03 16:17:44 -07:00
Mateo Wang
9b7acf791c
Merge pull request #39635 from BerriAI/litellm_off_peak_reasoning_cache_creation_rates
feat(cost): honor off_peak_pricing reasoning and cache-creation rates
2026-09-03 16:17:38 -07:00
mateo-berri
f15bdfb669 chore: merge litellm_internal_staging into the mid-stream failure logging branch
Keeps staging's response-id keying next to the pass-through failure-path helpers
and types the read-only raw_bytes parameters as Sequence[bytes] so the merged tree
stays inside the lint budgets
2026-09-03 15:51:51 -07:00
mateo-berri
24531ee576 refactor(cost): drop the docstrings that restate TokenRates and the new tests 2026-09-03 15:37:56 -07:00
mateo-berri
0bd2fd2a3b Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_lit6874_fireworks_perplexity_off_peak_pricing 2026-09-03 15:13:44 -07:00
mateo-berri
f9e41470d6 test(cost): type the off-peak fixture helpers with OffPeakPricing 2026-09-03 15:03:10 -07:00
mateo-berri
19da217167 fix(openai): mint workload identity tokens for PrivateLink and regional api.openai.com hosts 2026-09-03 14:38:47 -07:00
Mateo Wang
117ef33a41
Merge pull request #39541 from BerriAI/litellm_spend_logs_bridged_streaming_message_id
fix(anthropic_messages): key bridged streaming spend rows on the streamed msg_ id
2026-09-03 14:36:51 -07:00
Mateo Wang
3a00e8020a
Merge pull request #39464 from BerriAI/litellm_containers_error_passthrough_pagination
fix(containers): pass upstream error status through and forward list pagination params
2026-09-03 14:36:44 -07:00
Mateo Wang
f7691a3d85
Merge pull request #39411 from BerriAI/litellm_bedrock_bearer_skip_sigv4_chain
fix(bedrock): skip the SigV4 credential chain when a bearer token is configured
2026-09-03 14:36:27 -07:00
Mateo Wang
8699998c9e
Merge pull request #39625 from BerriAI/litellm_lit6873_vertex_passthrough_api_version
fix(vertex): add the API version to versionless project routes on the Vertex passthrough
2026-09-03 14:16:37 -07:00
mateo
5a3a2f3d0a Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_registry_audit_2026_09_02 2026-09-03 21:09:30 +00:00
Mateo Wang
025a3ca42f
Merge pull request #39631 from BerriAI/litellm_gpt_6_astra_detection
fix: treat gpt-6 names as the gpt-5 request family in OpenAI and Azure configs
2026-09-03 14:00:59 -07:00
mateo-berri
e65e3d0e2b fix(cost): bill fireworks cached tokens at the off-peak input rate when no cache-read rate exists 2026-09-03 13:45:17 -07:00
mateo-berri
e297968826 feat(cost): honor off_peak_pricing reasoning and cache-creation rates
The block accepts output_cost_per_reasoning_token and cache_creation_input_token_cost. The generic
cost path and the DashScope calculator swap them in while a window is open, and unset keys keep the
standard rate. One shared TokenRates value replaces the DashScope-local copy, and
apply_off_peak_pricing takes and returns it.
2026-09-03 13:45:06 -07:00
mateo-berri
d0ac494144 fix(cost): honor off_peak_pricing in the fireworks_ai and perplexity cost calculators 2026-09-03 13:31:56 -07:00