Skip to content

Commit 4ce1af2

Browse files
gHashTagclaude
andcommitted
security: Remove hardcoded API keys from scripts
IMPORTANT: This is an open source project! - Removed hardcoded Zhipu API key - All API keys now require environment variables - Reduced key display in logs (first 8 chars only) Set keys via environment: export GROQ_API_KEY="your-key" export ZHIPU_API_KEY="your-key" export ANTHROPIC_API_KEY="your-key" export COHERE_API_KEY="your-key" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 12772a5 commit 4ce1af2

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

scripts/multi_provider_hybrid.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def main():
604604

605605
# Get API keys from environment
606606
groq_key = os.environ.get("GROQ_API_KEY")
607-
zhipu_key = os.environ.get("ZHIPU_API_KEY", "fcbb5dadc5ea462284f5475a04daa174.Ei5KkZb0WQMwasmd")
607+
zhipu_key = os.environ.get("ZHIPU_API_KEY")
608608
anthropic_key = os.environ.get("ANTHROPIC_API_KEY")
609609
cohere_key = os.environ.get("COHERE_API_KEY")
610610

@@ -617,13 +617,13 @@ def main():
617617

618618
print("\nAvailable Providers:")
619619
if groq_key:
620-
print(f" ✓ Groq: {groq_key[:20]}...")
620+
print(f" ✓ Groq: {groq_key[:8]}***")
621621
if zhipu_key:
622-
print(f" ✓ Zhipu: {zhipu_key[:20]}...")
622+
print(f" ✓ Zhipu: {zhipu_key[:8]}***")
623623
if anthropic_key:
624-
print(f" ✓ Anthropic: {anthropic_key[:20]}...")
624+
print(f" ✓ Anthropic: {anthropic_key[:8]}***")
625625
if cohere_key:
626-
print(f" ✓ Cohere: {cohere_key[:20]}...")
626+
print(f" ✓ Cohere: {cohere_key[:8]}***")
627627

628628
# Initialize hybrid with available providers
629629
try:

scripts/zhipu_glm4_test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,17 @@ def main():
219219
print(f"\nφ² + 1/φ² = {phi_result:.10f}")
220220
print(f"Trinity identity verified: {abs(phi_result - 3.0) < 0.0001}")
221221

222-
# Get API key
222+
# Get API key from environment
223223
api_key = os.environ.get("ZHIPU_API_KEY")
224224
if not api_key:
225-
# Try hardcoded key for testing
226-
api_key = "fcbb5dadc5ea462284f5475a04daa174.Ei5KkZb0WQMwasmd"
225+
print("\n" + "=" * 70)
226+
print("ERROR: ZHIPU_API_KEY not set!")
227+
print("Run: export ZHIPU_API_KEY='your-key-here'")
228+
print("Get key at: https://open.bigmodel.cn")
229+
print("=" * 70)
230+
return
227231

228-
print(f"\nAPI Key: {api_key[:20]}...")
232+
print(f"\nAPI Key: {api_key[:8]}***")
229233

230234
# Initialize client
231235
try:

0 commit comments

Comments
 (0)