Try multiple API key secret names for compatibility
Browse filesCo-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -549,10 +549,18 @@ STAGE_FOCUS = {
|
|
| 549 |
# ============ CLAUDE INTEGRATION ============
|
| 550 |
|
| 551 |
def get_client():
|
| 552 |
-
"""Initialize Anthropic client"""
|
| 553 |
-
api_key =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
if not api_key:
|
| 555 |
-
raise ValueError(
|
|
|
|
|
|
|
|
|
|
| 556 |
return anthropic.Anthropic(api_key=api_key)
|
| 557 |
|
| 558 |
def call_claude(system_prompt, messages, context=""):
|
|
|
|
| 549 |
# ============ CLAUDE INTEGRATION ============
|
| 550 |
|
| 551 |
def get_client():
|
| 552 |
+
"""Initialize Anthropic client - try multiple possible secret names"""
|
| 553 |
+
api_key = (
|
| 554 |
+
os.environ.get("anthropic_key") or
|
| 555 |
+
os.environ.get("ANTHROPIC_KEY") or
|
| 556 |
+
os.environ.get("ANTHROPIC_API_KEY") or
|
| 557 |
+
os.environ.get("anthropic_api_key")
|
| 558 |
+
)
|
| 559 |
if not api_key:
|
| 560 |
+
raise ValueError(
|
| 561 |
+
"Anthropic API key not found. Please add a secret in Space Settings > Repository secrets. "
|
| 562 |
+
"Try naming it: ANTHROPIC_API_KEY"
|
| 563 |
+
)
|
| 564 |
return anthropic.Anthropic(api_key=api_key)
|
| 565 |
|
| 566 |
def call_claude(system_prompt, messages, context=""):
|