🤖 AI Chat Setup Guide

Enable your free AI oncology consultant in 5 minutes

📌 What you're setting up:
Your website will use 100% FREE AI services: Both are completely free, no credit card required!

1Get Free Google Gemini API Key

  1. Visit: https://aistudio.google.com/app/apikey
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Select "Create API key in new project" (or choose existing project)
  5. Copy the API key (starts with AIza...)
Your Gemini API key is: Free forever, 60 requests/minute, no credit card required

2Get Free Groq API Key (Backup)

  1. Visit: https://console.groq.com/keys
  2. Sign up for free (email + password, or Google login)
  3. Verify your email
  4. Click "Create API Key"
  5. Give it a name (e.g., "FightCancer Website")
  6. Copy the API key (starts with gsk_...)
Your Groq API key is: Free forever, 14,400 requests/day, lightning-fast responses

3Add API Keys to Your Website

  1. Open fightcancer_final.html in a text editor (Notepad++, VS Code, etc.)
  2. Press Ctrl+F to search for: AI_CONFIG
  3. Find these two lines:
const AI_CONFIG = {
    gemini: {
        apiKey: 'YOUR_GEMINI_API_KEY', // ← Replace this
        endpoint: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent'
    },
    groq: {
        apiKey: 'YOUR_GROQ_API_KEY', // ← Replace this
        endpoint: 'https://api.groq.com/openai/v1/chat/completions',
        model: 'llama-3.1-70b-versatile'
    }
};
  1. Replace 'YOUR_GEMINI_API_KEY' with your actual Gemini key
  2. Replace 'YOUR_GROQ_API_KEY' with your actual Groq key
  3. Save the file
⚠️ Important: Keep the quotes around the API keys! Example:
apiKey: 'AIzaSyC7x...' ✓ Correct
apiKey: AIzaSyC7x... ✗ Wrong (missing quotes)

4Test Your AI Chat

  1. Open fightcancer_final.html in your web browser
  2. Look for the button in the bottom-right corner
  3. Click it to open the AI chat panel
  4. Try asking: what is allulose?
  5. You should get an instant response from the local knowledge base
  6. Try asking: tell me something random about cancer treatment
  7. This should trigger the Gemini API (check browser console for confirmation)
If you see responses: Everything is working! Your AI consultant is now active.
💡 Check Browser Console: Press F12 → Console tab to see which AI is responding:
  • ✓ Answer from cache = Instant response from local knowledge
  • ✓ Answer from Gemini = Google AI responded
  • ✓ Answer from Groq = Groq backup AI responded

5Troubleshooting

Problem: "I'm having trouble connecting to my AI systems"

Problem: CORS errors in console

Problem: Rate limits exceeded

💰 Is This Really Free?

YES! 100% Free forever.

For a patient asking ~50 questions per day:

🎉 Setup Complete!

Your AI oncology consultant is now ready to help patients 24/7 with:

Chat history is saved privately on each patient's device (localStorage) for complete privacy.

Open Website Test Suite