jostlebot Claude Opus 4.5 commited on
Commit
7c399a2
·
1 Parent(s): 659ac32

Try multiple API key secret names for compatibility

Browse files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -549,10 +549,18 @@ STAGE_FOCUS = {
549
  # ============ CLAUDE INTEGRATION ============
550
 
551
  def get_client():
552
- """Initialize Anthropic client"""
553
- api_key = os.environ.get("anthropic_key")
 
 
 
 
 
554
  if not api_key:
555
- raise ValueError("anthropic_key environment variable not set. Add it in Space Settings > Repository secrets.")
 
 
 
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=""):