# AI Settings Guide

## 📌 Overview

WebVidra can use AI assistance to help generate and enhance your website content. You can choose from multiple AI providers, each with different capabilities and pricing models.

💡 Note: AI settings are stored locally on your computer. Your API keys are never shared with WebVidra or any third party.

### What You Need

- AI Provider: Choose which AI service to use
- Model Name: Select a specific model from your chosen provider
- API Key: Authentication credential for cloud providers (optional for local Ollama)

## 🤖 Supported AI Providers

Provider | Type | Cost | Setup Complexity
--- | --- | --- | ---
Local (Ollama) | Local Model | Free | Medium (requires installation)
OpenAI | Cloud API | Pay-per-use | Easy (API key only)
Groq Cloud | Cloud API | Free tier available | Easy (API key only)
Google Gemini | Cloud API | Free tier available | Easy (API key only)

## ⚙️ Provider Setup Guide

#### 🖥️ Local (Ollama)

Run AI models on your own computer with no internet required for inference.

### Step-by-Step Setup:

1. Download and install Ollama from https://ollama.ai
2. Run the Ollama application (it will run in the background on `http://localhost:11434`)
3. Open a terminal/command prompt and pull a model:
   ollama pull phi3
   or
   ollama pull llama2
   or
   ollama pull mistral
4. In WebVidra, select "Local (Ollama)" as the AI Provider
5. Enter the model name exactly as you pulled it (e.g., `phi3`, `llama2`)
6. No API Key is needed for local Ollama

✅ Advantages: Free, no internet required for inference, full privacy, no rate limits
⚠️ Requirements: Decent computer (8GB+ RAM recommended), Ollama must be running in background

Popular Models to Try:

- `phi3` - Small, fast, good for simple tasks
- `mistral` - Balanced, good quality
- `llama2` - Powerful, larger size
- `neural-chat` - Optimized for conversation

#### 🔵 OpenAI

Use GPT models from OpenAI (GPT-4, GPT-3.5-turbo, etc.)

### Step-by-Step Setup:

1. Go to https://platform.openai.com
2. Sign up or log in to your account
3. Click on your profile icon → Billing → Set up a payment method
4. Navigate to API keys (in left sidebar under "User" section)
5. Click Create new secret key
6. Copy the key immediately - it won't be shown again!
7. In WebVidra, select "OpenAI" as the AI Provider
8. Enter model name: `gpt-4` or `gpt-3.5-turbo`
9. Paste your API key

✅ Advantages: Most powerful, excellent quality, extensive model options
⚠️ Important: Requires paid account and API usage charges apply. Set up billing limits to avoid surprise costs.
📍 Direct Link: https://platform.openai.com/api-keys

#### ⚡ Groq Cloud

Fast inference with free tier and various model options.

### Step-by-Step Setup:

1. Go to https://console.groq.com
2. Sign up with email or Google account
3. Accept the terms and click Create account
4. In the dashboard, click API Keys in the left sidebar
5. Click Create API Key
6. Give it a name (e.g., "WebVidra") and create
7. Copy the key
8. In WebVidra, select "Groq Cloud" as the AI Provider
9. Enter a model name: `mixtral-8x7b-32768` or `llama2-70b-4096`
10. Paste your API key

✅ Advantages: Free tier available, very fast inference, good quality models
📍 Direct Link: https://console.groq.com/keys
📚 Available Models: Groq Model List

#### 🔴 Google Gemini

Use Google's latest AI models with free tier.

### Step-by-Step Setup:

1. Go to https://aistudio.google.com/app/apikey
2. Click Create API Key
3. Select "Create API key in new project" or choose existing project
4. Copy the API key
5. In WebVidra, select "Google Gemini" as the AI Provider
6. Enter model name: `gemini-pro` or `gemini-1.5-pro`
7. Paste your API key

✅ Advantages: Free tier with generous limits, multimodal capabilities, good quality
📍 Direct Link: https://aistudio.google.com/app/apikey
📚 Available Models: Google AI Model List

## 🔧 Configuration Steps in WebVidra

### 1. Open Global Settings

- In the main menu, find and click the ⚙️ Settings button
- The settings panel will slide in from the right

### 2. Configure AI Settings

- AI Provider: Select from the dropdown:
  - 🖥️ Local (Ollama) - for local models
  - 🔵 OpenAI - for GPT models
  - ⚡ Groq Cloud - for fast inference
  - 🔴 Google Gemini - for Google's AI
- Model Name: Enter the exact model identifier (examples provided above)
- API Key: Paste your authentication key
  - Only required for cloud providers (OpenAI, Groq, Google)
  - Not needed for local Ollama
  - Click Clear to remove the saved key

### 3. Save and Test

- Click the Save button at the bottom of the settings panel
- Settings are encrypted and saved to your computer
- They will persist even after closing and reopening WebVidra

✅ Settings Storage: Your AI settings (including API keys) are encrypted and stored in your user home directory at `~/.webvidra_ai_settings.json` (Linux/macOS) or `%USERPROFILE%\.webvidra_ai_settings.json` (Windows).

## 🔧 Troubleshooting

### Settings Keep Getting Cleared

- Problem: AI settings disappear after closing the app or clearing browser cache
- Solution: Your settings are automatically saved to disk. If they're cleared, try:
  - Restart WebVidra completely
  - Check that your home directory is writable
  - Re-enter settings and click Save again

### API Key Errors

- 401 Unauthorized: Your API key is invalid or expired
  - Generate a new API key from your provider's dashboard
  - Click Clear and paste the new key
  - Save settings again
- 403 Forbidden: Your API key doesn't have sufficient permissions
  - Check that the API key has the correct scopes/permissions
  - Generate a new key with proper permissions
- Rate Limited: You've made too many requests
  - Wait a few minutes before retrying
  - Consider upgrading to a higher tier on your provider

### Model Not Found Error

- For Ollama: Make sure Ollama is running and you've pulled the model
  ollama pull [model_name]
- For Cloud Providers: Verify the exact model name from your provider's documentation
- Check Spelling: Model names are case-sensitive

### Connection Timeout (Ollama)

- Problem: Cannot connect to local Ollama
- Solution:
  - Open terminal/command prompt
  - Run: `ollama serve`
  - Leave this window open while using WebVidra
  - Ollama must be running on port 11434

### Slow Response Times

- For Local Ollama: Use a faster model:
  - Try `phi3` or `neural-chat`
  - Ensure your computer has enough RAM
  - Close other applications to free up resources
- For Cloud Providers:
  - Check your internet connection
  - Try a faster model variant if available
  - Check provider status page for outages

## 🔒 Security & Privacy

🛡️ How Your Settings Are Protected:

- Encrypted Storage: API keys are encrypted using XOR encryption + Base64 encoding before being saved to disk
- Local Storage: Settings are stored only on your computer, never sent to WebVidra servers
- User Isolation: Stored in your home directory with user-level permissions
- No Cloud Backup: Your credentials are not backed up to any cloud service

⚠️ Best Practices:

- Never share your API keys or let others access your computer
- Treat API keys like passwords - keep them secure
- Regularly monitor your API usage to catch unauthorized access
- Rotate API keys periodically for cloud services
- If you suspect a key is compromised, regenerate it immediately

## ❓ Frequently Asked Questions

### Can I use multiple AI providers?

Yes! You can change providers and models at any time. Just update the settings and save. Your previous choice will be forgotten, so make a note if you want to switch back.

### What if I don't have an API key?

If you're using Local (Ollama), no API key is needed - it works completely offline. For cloud providers, sign up for free at their websites to get a key.

### Which provider is best for me?

It depends on your needs:

- Local Ollama: Best if you want free, offline, unlimited usage
- OpenAI: Best if you want the highest quality
- Groq: Best if you want free tier with fast inference
- Google Gemini: Best if you want free tier with good quality

### Will my settings sync across devices?

No, settings are stored locally on each computer. If you use WebVidra on multiple machines, you'll need to configure AI settings on each one.

### Can I disable AI features?

Yes, simply leave the AI settings empty or unconfigured. WebVidra will work normally without AI assistance.

### How often should I rotate my API keys?

For security, rotate keys every 3-6 months, or immediately if you suspect any compromise. Most providers make this easy through their dashboards.

Last updated: January 2026