mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-17 23:51:30 +00:00
The scheme enum assumed every static credential rides on the Authorization header with a prefix, which is true for bearer/basic/token/raw but wrong for api_key: v1 writes that one to the X-API-Key header (client.py:443-444), a different header entirely. Parity-testing the graft surfaced it. API-key headers are not standardized (OpenAPI models the header name as configurable; real upstreams vary - Atlassian uses Authorization: Bearer, MS Logic Apps and Spring AI use X-API-Key, Azure APIM uses Ocp-Apim-Subscription-Key), so model the placement as data: header_name (default Authorization) + value_prefix (default Bearer), like OpenAPI's apiKey scheme. This expresses every v1 auth_type and any custom upstream header, with no per-scheme enum and no leak. Replaces ApiKeyConfig.scheme/header_for with header_name/value_prefix/header(); the arm builds StaticHeaderAuth(value, header_name=name) via a small helper. The capability is not yet exposed to admins (that is the deferred server-configuration phase); the v1->v2 adapter will fill the pair from v1's auth_type. Test now covers bearer/basic/token/raw on Authorization plus X-API-Key and a custom header. 56 tests, gates green. |
||
|---|---|---|
| .. | ||
| gateway | ||
| test_configs | ||
| conftest.py | ||
| mcp_server.py | ||
| test_aresponses_api_with_mcp.py | ||
| test_mcp_auth_header_extraction.py | ||
| test_mcp_auth_priority.py | ||
| test_mcp_chat_completions.py | ||
| test_mcp_client_unit.py | ||
| test_mcp_guardrails.py | ||
| test_mcp_hooks.py | ||
| test_mcp_litellm_client.py | ||
| test_mcp_logging.py | ||
| test_mcp_server.py | ||
| test_oauth2_mcp_config.yaml | ||
| test_openapi_spec_path_url.py | ||
| test_per_user_oauth_cache.py | ||
| test_proxy_mcp_e2e.py | ||
| test_semantic_tool_filter_e2e.py | ||