Skip to content

refactor(anthropic): rename experimental_pass_through to pass_through - #43329

Merged
kerry-berri merged 3 commits into
mainfrom
litellm_rename_anthropic_pass_through
Sep 26, 2026
Merged

kerry-berri merged 3 commits into
mainfrom
litellm_rename_anthropic_pass_through

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • litellm/llms/anthropic/experimental_pass_through is the production /v1/messages path, not experimental
  • The name misleads readers and diverges from the pass_through naming used elsewhere

How it solves it:

  • git mv the package to litellm/llms/anthropic/pass_through, same for its tests/unit mirror
  • Rewrite every dotted import and slash path reference across code, tests, ruff config, docs and the e2e coverage registry
  • No behavior change: 129 files, 413 insertions and 413 deletions, all path text

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests (none needed, pure rename; tests/unit/llms/anthropic/pass_through runs unchanged, 1044 passed)
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Screenshots / Proof of Fix

Proxy started DB-free from the branch tip with the repo dev config and a real ANTHROPIC_API_KEY:

unset DATABASE_URL DIRECT_URL
LITELLM_MASTER_KEY=sk-1234 LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true \
  uv run --no-sync litellm --config litellm/proxy/dev_config.yaml --port 4010 --num_workers 1

After (ced64c3)

Native Anthropic path, POST /v1/messages

  1. curl -s http://localhost:4010/v1/messages -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model": "anthropic-sonnet-5", "max_tokens": 50, "messages": [{"role":"user","content":"Say hi in three words"}]}'
  2. Output (trimmed): {"model":"anthropic-sonnet-5","id":"msg_011CfSXUPSbKPQsDUXrCJ5Ef","type":"message","role":"assistant","content":[...,{"type":"text","text":"Hi there, friend!"}],"stop_reason":"end_turn",...,"usage":{"input_tokens":13,...,"output_tokens":29,...}}

OpenAI-compatible path, POST /v1/chat/completions

  1. curl -s http://localhost:4010/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model": "anthropic-sonnet-5", "max_tokens": 50, "messages": [{"role":"user","content":"Say hi in three words"}]}'
  2. Output (trimmed): {"id":"chatcmpl-32053d6f-b2df-4f08-be18-65b67c49c1e1","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Hi there, friend!","role":"assistant",...}}],"usage":{"completion_tokens":10,"prompt_tokens":13,"total_tokens":23,...}}

Renamed module resolves

  1. uv run --no-sync python -c "import litellm.llms.anthropic.pass_through.messages.handler as h; print(h.__file__)"
  2. Output: /home/ubuntu/repos/litellm/litellm/llms/anthropic/pass_through/messages/handler.py

No Before section: the merge base serves the same responses from the old path, and this PR only moves files

Type

🧹 Refactoring

Caveats (if any)

Medium

  • Third-party code importing litellm.llms.anthropic.experimental_pass_through.* breaks; no compat shim is added
  • Docs in the litellm-docs repo may still cite the old path and need a follow-up

Low

  • litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through is untouched on purpose
  • Three test function names still contain experimental_pass_through; they are names, not paths
  • pass_through/architecture.md is moved verbatim and is stale on the Responses API bridge, interceptors, MCP and websearch paths; tracked separately

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/45f1fdb83a7040cea2155b5022189c92
Open in Devin Desktop: https://app.devin.ai/desktop/session/45f1fdb83a7040cea2155b5022189c92?variant=devin
Requested by: @kerry-berri


Note

Low Risk
Mechanical rename with no logic changes; risk is limited to broken third-party imports of the old module path.

Overview
Renames the production Anthropic /v1/messages implementation from litellm.llms.anthropic.experimental_pass_through to litellm.llms.anthropic.pass_through, aligning the package name with how the feature is used elsewhere.

The change is a path-only refactor: imports, lazy-import registry entries, ruff dispatch rules, architecture docs, e2e coverage registry source paths, and unit tests are updated to the new module prefix. Runtime behavior is unchanged (symmetric ~413 line churn).

Breaking: any external code importing experimental_pass_through must switch to pass_through; there is no compatibility shim. Vertex partner code under vertex_ai/.../experimental_pass_through is intentionally left as-is.

Reviewed by Cursor Bugbot for commit aca4cca. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 26, 2026 18:30
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Renames experimental Anthropic pass-through module to stable.

The PR does not appear safe to merge until existing imports from the former Anthropic package path remain usable.

Findings

  1. P1 Former module import breaks ▶

Summary

The PR renames Anthropic’s production pass-through package and updates its internal references. Changes since the previous review also add optional fail-closed Redis rate-limit enforcement, adjust the compaction summary check, and expand limiter and authorization tests. The previously reported breakage for imports from the old package path remains unchanged.

Reviews (2) · Last reviewed commit: "test(anthropic): point compact patch tar..."

Comment thread litellm/__init__.py
)
from .llms.cohere.chat.transformation import CohereChatConfig as CohereChatConfig
from .llms.anthropic.experimental_pass_through.messages.transformation import (
from .llms.anthropic.pass_through.messages.transformation import (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Former module import breaks

If an existing SDK integration imports AnthropicMessagesConfig from litellm.llms.anthropic.experimental_pass_through.messages.transformation, it now gets ModuleNotFoundError: the package was moved without keeping the old import path. This violates the repository directive to avoid backwards-incompatible changes without a user-controlled flag. Keep the former path working during migration.

Rule Used: What: avoid backwards-incompatible changes without user-controlled flags Why: This breaks current behaviour for users using existing functionality Example of BAD: this PR (#22164) introduced run_post_custom... (source)

@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.52055% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lm/llms/anthropic/pass_through/adapters/handler.py 87.50% 1 Missing ⚠️
...lms/anthropic/pass_through/messages/mcp_handler.py 0.00% 1 Missing ⚠️
litellm/router.py 90.00% 1 Missing ⚠️
litellm/rust_bridge/callbacks_legacy_python.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_rename_anthropic_pass_through (aca4cca) with main (d18fcb0)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (9540f19) during the generation of this report, so d18fcb0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

kerry and others added 2 commits September 26, 2026 19:12
…path

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit aca4cca. Configure here.

@kerry-berri
kerry-berri merged commit 69ad004 into main Sep 26, 2026
104 checks passed
shrey-berri pushed a commit that referenced this pull request Sep 26, 2026
Main renamed litellm/llms/anthropic/experimental_pass_through to pass_through
(#43329), so the Gemini count builder and its oracle test import the adapter
and the messages handler from the new path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants