mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(anthropic): cover direct custom messages base
This commit is contained in:
parent
ed127727c4
commit
3794e14a9f
1 changed files with 22 additions and 6 deletions
|
|
@ -386,7 +386,26 @@ class TestPassthroughOAuth:
|
|||
assert updated_headers["x-api-key"] == FAKE_REGULAR_KEY
|
||||
assert "authorization" not in updated_headers
|
||||
|
||||
def test_passthrough_custom_base_uses_bearer_from_litellm_params(self):
|
||||
@pytest.mark.parametrize(
|
||||
("api_base", "litellm_params"),
|
||||
[
|
||||
(
|
||||
None,
|
||||
{
|
||||
"api_base": "https://custom-gateway.example.com",
|
||||
"use_bearer_for_custom_base": True,
|
||||
},
|
||||
),
|
||||
(
|
||||
"https://custom-gateway.example.com",
|
||||
{
|
||||
"api_base": "https://api.anthropic.com",
|
||||
"use_bearer_for_custom_base": True,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_passthrough_custom_base_uses_bearer(self, api_base, litellm_params):
|
||||
from litellm.llms.anthropic.experimental_pass_through.messages.transformation import (
|
||||
AnthropicMessagesConfig,
|
||||
)
|
||||
|
|
@ -398,12 +417,9 @@ class TestPassthroughOAuth:
|
|||
model="claude-sonnet-4-5-20250929",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
optional_params={},
|
||||
litellm_params={
|
||||
"api_base": "https://custom-gateway.example.com",
|
||||
"use_bearer_for_custom_base": True,
|
||||
},
|
||||
litellm_params=litellm_params,
|
||||
api_key="custom-api-key",
|
||||
api_base=None,
|
||||
api_base=api_base,
|
||||
)
|
||||
|
||||
assert updated_headers["authorization"] == "Bearer custom-api-key"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue