Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 2.42 KB

File metadata and controls

69 lines (49 loc) · 2.42 KB

API Setup Guide for DSA Hints Coach

Getting Your Gemini API Key

  1. Visit Google AI Studio

  2. Create API Key

    • Click "Create API Key" button
    • Choose "Create API Key in new project" or select an existing project
    • Copy the generated API key (it starts with "AIza...")
  3. Set Up in Extension

    • Open the DSA Hints Coach extension
    • Enter your API key in the prompt that appears
    • Click "Save & Test API Key"
    • The extension will test the key and save it securely

Environment Variables (Development)

For development purposes, you can also set the API key using environment variables:

  1. Create a .env file in the project root:

    GEMINI_API_KEY=your_actual_api_key_here
    GEMINI_API_URL=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
    
  2. Replace your_actual_api_key_here with your actual Gemini API key

Security Notes

  • The API key is stored securely in Chrome's sync storage
  • Never commit your actual API key to version control
  • The .env file is included in .gitignore to prevent accidental commits
  • API keys are encrypted when stored in Chrome storage

Troubleshooting

"Failed to generate hints" Error

If you're getting this error:

  1. Check API Key: Make sure your API key is valid and properly saved
  2. Test Connection: The extension will test your API key when you save it
  3. Check Quotas: Ensure you haven't exceeded your API usage limits
  4. Network Issues: Check your internet connection

Common Error Messages

  • "Invalid API key": Your API key is incorrect or expired
  • "Rate limit exceeded": You've hit the API usage limit, try again later
  • "Network error": Check your internet connection
  • "Server error": Google's servers are having issues, try again later

API Usage

The extension uses the Gemini 1.5 Flash model for generating hints. Each hint generation:

  • Uses approximately 100-200 tokens
  • Costs around $0.0001-0.0002 per request
  • Has a rate limit of 15 requests per minute

Support

If you continue to have issues:

  1. Check the browser console for detailed error messages
  2. Verify your API key is working in the Google AI Studio
  3. Ensure you have sufficient API quota remaining