Skip to content

Conversation

@dbschmigelski
Copy link
Member

Description

Doc updated related to strands-agents/sdk-python#808.

A customer complained that when they ran

litellm_model = LiteLLMModel(
client_args={
"api_key": "sk-1234",
"api_base": LITELLM_PROXY_URL # also fails for "base_url": LITELLM_PROXY_URL
},
model_id="amazon.nova-lite-v1:0"
)
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" or litellm.use_litellm_proxy = True.

Type of Change

  • Content update/revision

Motivation and Context

Explicitly instruct users who want to use the LiteLLM proxy

Areas Affected

https://strandsagents.com/latest/documentation/docs/user-guide/concepts/model-providers/litellm/

Screenshots

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • I have tested the documentation locally using mkdocs serve
  • [n/a] Links in the documentation are valid and working
  • [n/a] Images/diagrams are properly sized and formatted
  • All new and existing tests pass

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dbschmigelski dbschmigelski merged commit 01a1c30 into strands-agents:main Sep 9, 2025
2 checks passed
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.

3 participants