> ## Documentation Index
> Fetch the complete documentation index at: https://docs.heyquiz.pro/llms.txt
> Use this file to discover all available pages before exploring further.

# AI settings

> API key configuration and AI providers

## Overview

Hey Quiz allows using AI in two ways:

1. **Global pool** - use platform limits
2. **Your own API keys** - add your key and have no platform limits

## Accessing settings

<Steps>
  <Step title="Go to profile">
    Click your avatar in the top right corner.
  </Step>

  <Step title="Select Settings">
    Choose **"Settings"** from menu.
  </Step>

  <Step title="Go to AI tab">
    Click the **"AI Settings"** tab.
  </Step>
</Steps>

## Global pool

### How it works?

* Hey Quiz provides a pool of AI queries
* Use it without configuration
* Limits apply based on plan

### Limits

| Plan       | Daily generations |
| ---------- | ----------------- |
| Free       | 3                 |
| Basic      | 10                |
| Pro        | 50                |
| Enterprise | Unlimited         |

<Info>
  Limits reset at midnight (UTC).
</Info>

## Your own API keys

### Why use them?

<Check>
  **No platform limits** - generate as much as you want
</Check>

<Check>
  **Model choice** - use the latest models
</Check>

<Check>
  **Cost control** - pay only for what you use
</Check>

<Check>
  **Privacy** - direct communication with provider
</Check>

### Supported providers

| Provider       | Models            | Website       |
| -------------- | ----------------- | ------------- |
| **OpenRouter** | Multiple models   | openrouter.ai |
| **Anthropic**  | Claude 3, 3.5     | anthropic.com |
| **OpenAI**     | GPT-4, GPT-4o     | openai.com    |
| **Google**     | Gemini Pro, Ultra | ai.google.dev |
| **xAI**        | Grok              | x.ai          |
| **Mistral**    | Mistral Large     | mistral.ai    |

## Adding an API key

<Steps>
  <Step title="Get API key">
    Register with your chosen provider and generate an API key.
  </Step>

  <Step title="Go to AI settings">
    In Hey Quiz: Settings → AI Settings.
  </Step>

  <Step title="Select provider">
    Click **"Add API Key"** and choose provider.
  </Step>

  <Step title="Paste key">
    Copy the API key and paste it in the field.
  </Step>

  <Step title="Save">
    Click **"Save"** - key will be encrypted.
  </Step>
</Steps>

### Where to find API key?

<AccordionGroup>
  <Accordion title="OpenRouter">
    1. Go to openrouter.ai
    2. Log in / register
    3. Go to Settings → API Keys
    4. Click "Create Key"
    5. Copy the generated key
  </Accordion>

  <Accordion title="Anthropic (Claude)">
    1. Go to console.anthropic.com
    2. Log in / register
    3. Go to API Keys
    4. Click "Create Key"
    5. Copy the key (starts with "sk-ant-")
  </Accordion>

  <Accordion title="OpenAI">
    1. Go to platform.openai.com
    2. Log in / register
    3. Go to API Keys
    4. Click "Create new secret key"
    5. Copy the key (starts with "sk-")
  </Accordion>

  <Accordion title="Google (Gemini)">
    1. Go to ai.google.dev
    2. Log in with Google account
    3. Go to "Get API Key"
    4. Create project and generate key
    5. Copy the key
  </Accordion>
</AccordionGroup>

## Key security

<Info>
  **Your keys are secure:**

  * Encrypted with AES-256 algorithm
  * Stored in secure database
  * Never displayed in full form
  * Accessible only to you
</Info>

### Best practices

<Warning>
  **Never share your API key!**

  * Don't send it via email
  * Don't paste on forums/chats
  * Don't save in public places
</Warning>

## Model selection

After adding a key, you can choose your preferred model:

### OpenRouter

Access to many models from various providers:

* Claude 3.5 Sonnet
* GPT-4o
* Gemini Pro
* Llama 3
* and many more

### Anthropic

| Model             | Use case                       |
| ----------------- | ------------------------------ |
| Claude 3.5 Sonnet | Fast, good quality/price ratio |
| Claude 3 Opus     | Highest quality                |
| Claude 3 Haiku    | Cheapest, fast                 |

### OpenAI

| Model       | Use case           |
| ----------- | ------------------ |
| GPT-4o      | Latest, multimodal |
| GPT-4 Turbo | Fast, good quality |
| GPT-4       | Classic, stable    |

## Costs

### Estimated generation costs

| Model             | \~10 questions | \~25 questions |
| ----------------- | -------------- | -------------- |
| GPT-4o            | \~\$0.03       | \~\$0.07       |
| Claude 3.5 Sonnet | \~\$0.02       | \~\$0.05       |
| Gemini Pro        | \~\$0.01       | \~\$0.03       |

<Info>
  Costs are estimates and depend on prompt and response length.
</Info>

### Monitoring usage

Check usage on provider's website:

* OpenAI: platform.openai.com/usage
* Anthropic: console.anthropic.com/usage
* Google: cloud.google.com/billing

## Key management

### Editing a key

1. Go to AI Settings
2. Find the key to edit
3. Click edit icon
4. Enter new key
5. Save changes

### Deleting a key

1. Go to AI Settings
2. Find the key to delete
3. Click trash icon
4. Confirm deletion

<Warning>
  After deleting a key, you'll return to using the global pool (with limits).
</Warning>

## Troubleshooting

<AccordionGroup>
  <Accordion title="API key doesn't work">
    * Check if key is correct (copy again)
    * Check if you have funds in provider account
    * Check if key hasn't expired
    * Make sure you selected the right provider
  </Accordion>

  <Accordion title="Authorization error">
    * Key may be invalid
    * Account with provider may be blocked
    * Check limits on provider account
  </Accordion>

  <Accordion title="Generation is slow">
    * Provider servers may be overloaded
    * Try a different model
    * Check provider's service status
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Generate from topic" icon="lightbulb" href="/en/ai/generating">
    Create quiz by describing a topic
  </Card>

  <Card title="Generate from document" icon="file-pdf" href="/en/ai/documents">
    Upload a file and generate questions
  </Card>
</CardGroup>
