| name | test-api-keys-ai-universe |
| description | Test API keys against jleechanorg/ai_universe repository services |
| type | testing |
| scope | project |
Test API Keys Against AI Universe Repository
This skill provides a script to test API keys from your .bashrc against the actual services used by the jleechanorg/ai_universe repository.
Overview
The script:
- Clones the
ai_universe repository to /tmp
- Tests API keys against the actual API endpoints used by the repo
- Validates GitHub access to the repository
- Tests LLM API keys (Gemini, OpenAI, Anthropic, Perplexity, OpenRouter)
- Provides a summary of test results
Prerequisites
curl installed (usually pre-installed on macOS/Linux)
git installed
- API keys configured in
~/.bashrc
- Internet connection
Usage
Basic Usage
bash /tmp/test_ai_universe_api_keys.sh
The script will:
- Load API keys from
~/.bashrc
- Clone the
ai_universe repository to /tmp/ai_universe_api_test_*/
- Test each API key against its respective service
- Display results and cleanup temporary files
What Gets Tested
The script tests the following API keys (loaded from ~/.bashrc):
| API Key | Service | Purpose in AI Universe |
|---|
GITHUB_TOKEN | GitHub API | Repository access and authentication |
GEMINI_API_KEY | Google Gemini | Primary AI model for game master |
OPENAI_API_KEY | OpenAI | Multi-model synthesis |
ANTHROPIC_API_KEY | Anthropic Claude | Multi-model synthesis |
PERPLEXITY_API_KEY | Perplexity | Multi-model synthesis |
OPENROUTER_API_KEY | OpenRouter | Multi-model synthesis |
Expected Output
========================================
AI Universe API Key Testing
========================================
Loading API keys from ~/.bashrc...
Cloning ai_universe repository...
✅ Repository cloned successfully
Checking API key usage in repository...
✅ Found API key references in:
- backend/server.py
- frontend/src/services/ai.ts
Testing API keys...
Testing GitHub repo access...
✅ GitHub token valid - Can access repo: jleechanorg/ai_universe
Testing Gemini API...
✅ Gemini API key valid - Can list models
Testing OpenAI API...
✅ OpenAI API key valid
Testing Anthropic API...
✅ Anthropic API key valid
Testing Perplexity API...
✅ Perplexity API key valid
Testing OpenRouter API...
✅ OpenRouter API key valid
========================================
Test Summary
========================================
Passed: 6
Failed: 0
Total: 6
✅ All API keys are valid!
Troubleshooting
Script Not Found
If the script doesn't exist at /tmp/test_ai_universe_api_keys.sh, you can recreate it:
API Keys Not Found
If you see "❌ API_KEY not set" errors:
-
Verify keys are in .bashrc:
grep -E "export (GITHUB_TOKEN|GEMINI_API_KEY|OPENAI_API_KEY|ANTHROPIC_API_KEY|PERPLEXITY_API_KEY|OPENROUTER_API_KEY)=" ~/.bashrc
-
Reload your shell:
source ~/.bashrc
-
Check key format:
- Keys should be exported with
export KEY_NAME="value"
- No spaces around the
= sign
- Quotes are optional but recommended
GitHub Access Denied
If GitHub token test fails:
-
Check token permissions:
- Token needs
repo scope for private repositories
- Token needs
read:org for organization repositories
-
Verify token is valid:
curl -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user
-
Regenerate token if needed:
API Key Invalid Errors
If an API key test fails:
-
Check the key value:
echo $GEMINI_API_KEY
-
Verify key hasn't expired:
- Some API keys have expiration dates
- Check your account dashboard for the service
-
Check quota/credits:
- Some services may show "valid" but have no credits
- Check your account balance
Repository Clone Fails
If the repository clone fails:
-
Check network connectivity:
ping github.com
-
Verify repository exists:
curl -I https://github.com/jleechanorg/ai_universe
-
Check GitHub access:
- Repository might be private
- Your GitHub token needs appropriate permissions
Integration with Other Tools
Use with CI/CD
You can integrate this script into CI/CD pipelines:
- name: Test API Keys
run: |
bash /tmp/test_ai_universe_api_keys.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
Use with Monitoring
Set up a cron job to test keys periodically:
0 2 * * * bash /tmp/test_ai_universe_api_keys.sh >> /tmp/api_key_test.log 2>&1
Security Notes
- Temporary Files: The script creates temporary directories in
/tmp/ that are automatically cleaned up
- API Keys: Keys are loaded from
~/.bashrc but not logged or stored
- Repository: Only clones the repository temporarily for analysis
- Network: Makes API calls to validate keys - ensure you're on a secure network
Related Skills
Script Location
The script is located at:
- Path:
/tmp/test_ai_universe_api_keys.sh
- Working Directory:
/tmp/ai_universe_api_test_*/ (temporary, auto-cleaned)
- Repository Clone:
/tmp/ai_universe_api_test_*/ai_universe/ (temporary)
Maintenance
The script is automatically maintained and can be recreated if needed. To update:
- Ask Claude to recreate the script
- Or modify the script directly at
/tmp/test_ai_universe_api_keys.sh
Example Workflow
bash /tmp/test_ai_universe_api_keys.sh
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/user
curl "https://generativelanguage.googleapis.com/v1beta/models?key=$GEMINI_API_KEY"
bash /tmp/test_ai_universe_api_keys.sh