AI & Integrations

AI Features

Cleanmails supports 6 LLM providers for AI auto-reply, email enhancement, and the MCP integration. Bring your own API key — no usage fees from Cleanmails.

Supported Providers

ProviderModels
OpenAIgpt-5.4-nano, gpt-5.4-mini, gpt-oss-20b, gpt-4.1, gpt-4.1-mini
Claude (Anthropic)claude-haiku-4-5, claude-sonnet-4-6, claude-opus-4, claude-sonnet-4, claude-3-5-haiku
Gemini (Google)gemini-3.1-flash-lite, gemini-3-flash-preview, gemini-2.5-flash, gemini-2.5-pro
Groqllama-3.1-8b-instant, llama-4-scout-17b, gpt-oss-20b, llama-3.3-70b, qwen-qwq-32b
AWS Bedrockamazon.nova-micro, amazon.nova-lite, claude-haiku-4-5, amazon.nova-pro, claude-sonnet-4
OpenRouteropenrouter/free, gpt-oss-20b, llama-3.3-70b, claude-haiku-4-5, gemini-3.1-flash-lite

Setup

  1. Go to Settings → AI tab
  2. Select your provider from the dropdown
  3. Enter your API key
  4. Select a model (each provider shows 5 options)
  5. Click Test Connection to verify
  6. Save
Key security

API keys are encrypted with AES-256-GCM before storage. They are never exposed in API responses — the dashboard only shows whether a key is configured (has_ai_key: true/false).

AI Auto-Reply

When enabled per campaign, the AI will automatically draft and send replies to inbound emails from leads:

  • Triggered when a lead replies to a campaign email
  • Uses the last 5 messages in the thread for context
  • Respects a per-campaign AI context prompt (you define the tone, product, goals)
  • Adds a human-mimicry delay (1–5 minutes) before sending
  • Sends with correct threading headers (In-Reply-To, References)
  • Max 3 AI replies per thread (loop prevention)
  • Never replies to bounces or system emails

Enabling Auto-Reply

In the campaign builder (Step 6: Scheduler):

  1. Toggle AI Auto-Reply ON
  2. Write an AI context prompt explaining your product/service and reply guidelines

AI Email Enhancer

Rewrite email content in the campaign builder without losing personalization variables:

  • Rewrite — Full rewrite maintaining intent
  • Shorten — Make the email more concise
  • Formal — Adjust tone to professional
  • Remove Spam — Rephrase spam trigger words

The enhancer extracts {{ variables and spintax before sending to the LLM, then restores them in the output — so your personalization is preserved.

Token Budget

Each workspace has a configurable daily token cap (default: 10,000 tokens). This prevents runaway costs from AI auto-replies:

  • Token usage is tracked per request (prompt + completion)
  • When the cap is reached, AI features are disabled until the next daily reset
  • The reset runs as a periodic background task
  • Configure the cap in Settings → AI → Daily Token Cap

Settings API

MethodEndpointDescription
GET/api/v1/workspaces/:wid/settingsGet AI config (provider, model, has_key, tokens_used)
PUT/api/v1/workspaces/:wid/settingsUpdate provider, key, model, token cap
POST/api/v1/workspaces/:wid/settings/test-aiTest AI connection (sends "Say hello")
POST/api/v1/workspaces/:wid/ai/enhanceEnhance/rewrite email content
POST/api/v1/workspaces/:wid/ai/spam-checkCheck email for 200+ spam trigger words
Cost-effective setup

For auto-reply, use a fast/cheap model (Gemini 3.1 Flash Lite, GPT-5.4-nano, or Groq Llama). For email enhancement, use a higher-quality model (GPT-4.1, Claude Sonnet 4). You can switch models anytime from Settings.