Skip to content

Migrate from litellm to any-llm - #822

Open
eb8680 wants to merge 2 commits into
masterfrom
eb-anyllm
Open

eb8680 wants to merge 2 commits into
masterfrom
eb-anyllm

Conversation

@eb8680

@eb8680 eb8680 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Addresses #821

This PR migrates handlers.llm from litellm to any-llm, as suggested in #821, removing litellm entirely as a dependency. For the most part it's a seamless migration because any-llm is designed for exactly this.

There is one annoying but important edge case which litellm handled but any-llm does not: OpenAI's first-party Completion API (via any_llm.completion) does not support reasoning when there are tools in the mix; OpenAI want you to use their Responses API instead (via any_llm.responses). This breaks uniform model access through any_llm.completion for OpenAI models.

The path of least resistance is to do what litellm.completion already does, which is recognize those models and translate the completion call to an equivalent responses call. The any-llm developers have said they have no plans to do this themselves, so it has to live in our code as a bunch of private helper functions in handlers.llm.harness.provision.any_llm.

Apart from this, the diff is mostly just boilerplate accounting for small API and behavior changes from the migration.

I think this PR is almost complete but it is a large breaking change and mostly LLM-authored so I want to run all the examples end-to-end and examine the outputs myself to make sure there are no subtle regressions I've missed, e.g. in the integration with langfuse.

@eb8680
eb8680 marked this pull request as ready for review October 23, 2026 20:42
@eb8680
eb8680 requested a review from jfeser October 23, 2026 20:43
@eb8680

eb8680 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

This can be reviewed and merged. I inspected some examples and everything seems to check out.

@jfeser jfeser linked an issue Oct 23, 2026 that may be closed by this pull request
@eb8680 eb8680 added the blocked label Oct 26, 2026
@eb8680

eb8680 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

I will rebase this on master once #824 lands

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace or pin LiteLLM

1 participant