generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 445
fix(models): patch litellm bug to honor passing in use_litellm_proxy as client_args #808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dbschmigelski
merged 6 commits into
strands-agents:main
from
dbschmigelski:fix/litellm-use_litellm_proxy
Sep 9, 2025
Merged
fix(models): patch litellm bug to honor passing in use_litellm_proxy as client_args #808
dbschmigelski
merged 6 commits into
strands-agents:main
from
dbschmigelski:fix/litellm-use_litellm_proxy
Sep 9, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 tasks
zastrowm
reviewed
Sep 8, 2025
zastrowm
previously approved these changes
Sep 8, 2025
pgrayy
reviewed
Sep 8, 2025
pgrayy
approved these changes
Sep 8, 2025
mehtarac
approved these changes
Sep 9, 2025
This was referenced Sep 11, 2025
This was referenced Sep 17, 2025
Closed
Unshure
pushed a commit
to Unshure/sdk-python
that referenced
this pull request
Sep 24, 2025
…as client_args (strands-agents#808) * fix(models): patch litellm bug to honor passing in use_litellm_proxy as client_args --------- Co-authored-by: Patrick Gray <[email protected]>
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A customer complained that when they ran
They were seeing
httpx.HTTPStatusError: Client error '404 Not Found' for url '{LITELLM_PROXY_URL}/model/amazon.nova-pro-v1%3A0/converse'
The reason for this is that LiteLLM recognizes the model as a Bedrock model, so it selects the BedrockModel provider. Then it uses api_base in a similar way to how in the Strand BedrockModel we have
endpoint_url
. So LiteLLM, as a client, is making a request to Bedrock but assuming Bedrock is behind some other endpoint.What the customer expected, is that the request would be route to their own LiteLLM Proxy Server. As stated above, setting the api_base does NOT indicate that the LiteLLM Proxy Server should be used, it indicates that the selected model provider happens to. have an endpoint different than the default one - for example for bedrock the default is
https://bedrock-runtime.{region}.amazonaws.com
So the primary fix will be to update https://strandsagents.com/latest/documentation/docs/user-guide/concepts/model-providers/litellm/.
The fix in this PR is to make it easier for customers to use the proxy. There are three methods described in BerriAI/litellm#13454 but according to BerriAI/litellm#13454 passing in as a dynamic param is broken. Meaning without this fix, customers would need to break the abstraction in Strands and directly do
os.environ["USE_LITELLM_PROXY"] = "True"
orlitellm.use_litellm_proxy = True
.This, and the doc fix, will address #661 which until now we did not realize was the same issue.
Related Issues
#661
Documentation PR
strands-agents/docs#233
Type of Change
Bug fix
Testing
Run
export LITELLM_PROXY_API_KEY=sk-1234; litellm -m amazon.nova-lite-v1:0
then
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepare
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.