Skip to content

Commit b2f8869

Browse files
committed
refactor(aicore): rename AICORE_PROXY_VIRTUAL_KEY → AICORE_PROXY_API_KEY
The previous name was misleading — the SDK reads the LiteLLM proxy master API key, not a virtual (per-user/per-team) key. AICORE_PROXY_API_KEY is accurate for both master key and virtual key usage. Aligned with Sam Garland (CAD) feedback on ADR 0039 review.
1 parent 7ad244d commit b2f8869

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/sap_cloud_sdk/aicore/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# Option 3 — transparent proxy routing.
3939
# Deployer injects these; agent code is identical in all environments.
4040
_PROXY_URL_ENV = "AICORE_PROXY_URL"
41-
_PROXY_VIRTUAL_KEY_ENV = "AICORE_PROXY_VIRTUAL_KEY"
41+
_PROXY_API_KEY_ENV = "AICORE_PROXY_API_KEY"
4242
_DESTINATION_NAME_ENV = "AICORE_DESTINATION_NAME"
4343

4444

@@ -186,10 +186,10 @@ def _configure_proxy_mode(proxy_url: str) -> None:
186186
"""
187187
import litellm as _litellm
188188

189-
virtual_key = os.environ.get(_PROXY_VIRTUAL_KEY_ENV, "")
189+
api_key = os.environ.get(_PROXY_API_KEY_ENV, "")
190190
_litellm.api_base = proxy_url
191-
if virtual_key:
192-
_litellm.api_key = virtual_key
191+
if api_key:
192+
_litellm.api_key = api_key
193193
logger.info("AI Core proxy mode active — routing via %s", proxy_url)
194194

195195

tests/aicore/unit/test_aicore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ def test_proxy_mode_sets_litellm_api_key_when_virtual_key_present(self):
865865
patch("sap_cloud_sdk.aicore.set_filtering"),
866866
patch.dict(
867867
"os.environ",
868-
self._base_proxy_env(AICORE_PROXY_VIRTUAL_KEY="sk-virt-123"),
868+
self._base_proxy_env(AICORE_PROXY_API_KEY="sk-virt-123"),
869869
clear=True,
870870
),
871871
):

0 commit comments

Comments
 (0)