# AI Configuration

## Creativity Level (Temperature)

The Creativity Level slider controls how predictable or inventive the AI's replies are. Think of temperature as a creativity dial — lower values give more predictable, factual responses, while higher values produce more creative and varied replies. Technically, this maps to the AI model's temperature parameter.

Setting | Temperature | Behavior
--- | --- | ---
Low (Conservative) | 0.1 – 0.3 | Very predictable, sticks closely to facts and templates. Best for legal, medical, or financial replies where accuracy is critical.
Medium (Balanced) | 0.4 – 0.6 | Good mix of accuracy and natural-sounding language. Recommended default for most businesses.
High (Creative) | 0.7 – 1.0 | More varied and creative phrasing. Good for marketing or casual conversations, but may occasionally produce unexpected wording.

> Recommendation: Start at Medium (0.5). Only increase if replies feel too robotic, or decrease if they feel too unpredictable.

## Confidence Level

The Confidence Level setting defines the minimum confidence score an AI reply must achieve before it is considered ready. This directly affects auto-send behavior:

- High (85–100): Only very confident replies are auto-sent. More replies go to manual review. Safest option.
- Medium (65–84): Moderate threshold. A balanced approach for established knowledge bases.
- Low (50–64): More replies are auto-sent, but with higher risk of inaccurate responses. Only use if you have thoroughly tested your Knowledge Base.

Navigate to Settings → AI Configuration → Confidence Level to adjust. The confidence score for each reply is visible in the conversation thread next to the AI badge.

## Reply Length Settings

Control how long or short AI-generated replies should be:

- Concise: 1–3 sentences. Quick, direct answers. Ideal for support tickets with simple questions.
- Standard: 3–6 sentences. Provides context and explanation. Recommended default.
- Detailed: 6–12 sentences. Thorough responses with step-by-step instructions. Good for technical support.
- Custom: Set a specific maximum word count or token limit.

The AI treats this as a guideline, not a hard limit. A "Concise" reply to a complex question may still be a few sentences longer than usual if the answer genuinely requires it.

## Language Settings

Configure how the AI handles language in replies:

- Auto-detect (default): The AI detects the language of the incoming email and replies in the same language.
- Fixed language: Force all AI replies to use a specific language (e.g., English, Spanish, German), regardless of the incoming email language.
- Primary + fallback: Reply in the detected language if supported, otherwise fall back to your primary language.

Configure at Settings → AI Configuration → Language.

## Greeting and Sign-off Customization

You can define custom greetings and sign-offs that the AI will use in every reply:

- Greeting: e.g., "Hi {first_name}," or "Hello," or "Dear {first_name},"
- Sign-off: e.g., "Best regards,\n{agent_name}\n{company_name}" or "Thanks,\nThe {company_name} Team"

Available placeholders:

Placeholder | Replaced With
--- | ---
`{first_name}` | Recipient's first name (from contact record or email)
`{last_name}` | Recipient's last name
`{full_name}` | Recipient's full name
`{agent_name}` | Name of the assigned agent or account owner
`{company_name}` | Your company name from settings

## Max AI Replies Per Conversation

To prevent infinite AI reply loops (especially in auto-send mode), you can set a maximum number of AI replies allowed in a single conversation thread. Once the limit is reached, new emails in that thread are flagged for human review.

- Default: 5 replies per conversation.
- Range: 1 to 50 (or unlimited).

This is especially important when two automated systems are emailing each other. Without a cap, they could exchange hundreds of messages in minutes.

## AI Spending Cap Setup

AI API calls cost money. MailTrixy lets you set a spending cap so you never get a surprise bill from your AI provider.

1. Go to Settings → AI Configuration → Spending Limits.
2. Set a daily limit (e.g., $5/day) and/or a monthly limit (e.g., $100/month).
3. Choose what happens when the limit is reached:
   - Pause AI replies: Stop generating AI replies until the next period.
   - Switch to cheaper model: Automatically downgrade from GPT-4o to GPT-4o-mini.
   - Notify only: Send an alert but continue generating replies.

MailTrixy tracks token usage for every AI request and displays real-time cost estimates on the dashboard.

## Monthly Cost Limit Configuration

The monthly cost limit is a hard cap on total AI spending across all users on your MailTrixy instance (for SaaS operators) or for your account (for single-tenant users).

- Admin-level limit: The system administrator sets a global monthly budget. Once reached, AI features are paused for all users until the next billing cycle.
- Per-user limit: In SaaS mode, each subscription plan can have its own AI budget. For example, the Basic plan might allow $10/month in AI usage while the Pro plan allows $50/month.
- Usage dashboard: Both admins and users can see a real-time breakdown of AI costs by provider, model, and day.

Configure at Admin Panel → Plans → Edit Plan → AI Limits for per-plan limits, or Settings → AI Configuration → Global Limits for system-wide limits.