# AI Providers Setup

## OpenAI Setup

OpenAI is the most popular AI provider and the recommended default for MailTrixy.

1. Go to platform.openai.com/api-keys and sign in.
2. Click Create new secret key. Give it a name like "MailTrixy".
3. Copy the key immediately (it will not be shown again).
4. In MailTrixy, go to Settings → AI Providers → OpenAI.
5. Paste the API key and click Test Connection.
6. Select your preferred model.

### Available Models

Model | Best For | Speed | Cost
--- | --- | --- | ---
GPT-4o | Complex replies, nuanced understanding | Fast | ~$2.50/1M input, ~$10/1M output
GPT-4o-mini | High volume, simple queries | Very fast | ~$0.15/1M input, ~$0.60/1M output

> Tip: Start with GPT-4o-mini for cost efficiency. Switch to GPT-4o if you find the quality insufficient for your use case.

## Anthropic Setup (Claude)

Anthropic's Claude models are known for careful, nuanced responses and strong instruction-following.

1. Go to console.anthropic.com and create an account.
2. Navigate to API Keys and create a new key.
3. Copy the key.
4. In MailTrixy, go to Settings → AI Providers → Anthropic.
5. Paste the API key and click Test Connection.
6. Select your preferred Claude model (Claude Sonnet 4, Claude Haiku, etc.).

Claude models excel at following complex personality instructions and producing safe, well-structured replies. They are an excellent choice for customer support and professional communications.

## Google Gemini Setup

Google's Gemini models offer competitive performance and are available through Google AI Studio.

1. Go to aistudio.google.com/apikey.
2. Click Create API key and select a Google Cloud project (or create one).
3. Copy the generated API key.
4. In MailTrixy, go to Settings → AI Providers → Google Gemini.
5. Paste the API key, select a Gemini model (Gemini 2.0 Flash, Gemini 2.5 Pro, etc.), and test the connection.

Gemini models offer a generous free tier, making them a good option for testing and low-volume usage.

## Mistral Setup

Mistral provides efficient, open-weight models hosted through their API platform.

1. Go to console.mistral.ai and sign up.
2. Create an API key from the dashboard.
3. In MailTrixy, go to Settings → AI Providers → Mistral.
4. Paste the API key, select a model (Mistral Large, Mistral Small, etc.), and test the connection.

Mistral models are particularly strong in European languages (French, German, Spanish, Italian) and offer competitive pricing.

## How to Choose the Right Provider

Consider these factors when selecting your AI provider:

- Reply quality: GPT-4o and Claude Sonnet 4 generally produce the highest-quality replies. GPT-4o-mini and Gemini Flash are excellent for straightforward questions.
- Cost: If budget is a primary concern, GPT-4o-mini and Gemini Flash offer the best value per token.
- Speed: Smaller models (GPT-4o-mini, Gemini Flash, Mistral Small) respond faster, which matters for auto-send and live chat.
- Data privacy: Review each provider's data retention policies. Anthropic and Mistral both commit to not training on API data by default.
- Language support: All providers support major world languages. Mistral has an edge for European languages; Gemini performs well with Asian languages.

## Cost Comparison Table

Approximate costs per 1 million tokens (as of early 2026). Prices are subject to change — check each provider's pricing page for the latest rates.

Provider / Model | Input (per 1M tokens) | Output (per 1M tokens) | Quality Tier
--- | --- | --- | ---
OpenAI GPT-4o | $2.50 | $10.00 | Premium
OpenAI GPT-4o-mini | $0.15 | $0.60 | Standard
Anthropic Claude Sonnet 4 | $3.00 | $15.00 | Premium
Anthropic Claude Haiku | $0.25 | $1.25 | Standard
Google Gemini 2.5 Pro | $1.25 | $10.00 | Premium
Google Gemini 2.0 Flash | $0.10 | $0.40 | Budget
Mistral Large | $2.00 | $6.00 | Premium
Mistral Small | $0.20 | $0.60 | Standard

> Note: A typical email reply uses approximately 500–2000 tokens of input (email + context) and 200–800 tokens of output. At GPT-4o-mini rates, 1,000 email replies cost roughly $0.50–$1.00.

## Switching Providers

You can switch AI providers at any time without losing data. Here is how:

1. Configure the new provider (add API key, select model, test connection).
2. Go to Settings → AI Configuration → Active Provider.
3. Select the new provider from the dropdown.
4. Click Save.

All new AI replies will use the new provider immediately. Previous replies are not affected. Your Knowledge Base embeddings are provider-independent — they do not need to be regenerated when you switch providers (unless you also change the embedding model).

> Tip: You can configure multiple providers and set a fallback. If your primary provider's API is down, MailTrixy will automatically route requests to the fallback provider.