Setting Up AI
This guide walks you through enabling and configuring AI features in ElmapiCMS.
1. Add Your API Key
Open your .env file and add the API key for your preferred provider:
# OpenAI
OPENAI_API_KEY=sk-...
# Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# Google Gemini
GEMINI_API_KEY=AI...You only need one provider configured, but you can add multiple and switch between them in the settings.
Where to get API keys
- OpenAI: platform.openai.com/api-keys
- Anthropic: console.anthropic.com/settings/keys
- Google Gemini: aistudio.google.com/apikey
2. Open AI Settings
Navigate to App Settings > AI from the left sidebar. This page is only accessible to administrators.
3. Enable AI Features
Toggle the AI Features switch to enable AI across the application. When disabled, the AI chat panel, inline content tools, and AI translation buttons will be hidden.
4. Select a Provider
Choose your AI provider from the dropdown. Each provider shows a status badge:
- Configured (green): The API key is present in your
.envfile - No API key (amber): The API key is missing. Add it to
.envand restart your app
5. Configure Settings
Model Override
Leave this field empty to use the provider's default model. If you want to use a specific model, enter its name (e.g., gpt-4o, claude-haiku-4-20250414, gemini-2.0-flash-lite).
The AI Assistant requires a model with tool calling support. Most modern models support this, but some smaller or older models may not. The inline content tools work with any text generation model.
Show Token Usage
When enabled, a small token counter appears at the bottom of the AI chat panel showing prompt and completion tokens used in the current conversation.
Max Output Tokens
Controls the maximum length of AI responses. The default of 4096 works well for most tasks.
| Value | Use Case |
|---|---|
| 1024 | Short responses |
| 4096 | Normal (default) |
| 8192 | Longer content |
| 16384 | Very long content generation |
Max Steps
Limits how many tool-calling rounds the AI assistant can perform per response. Each step allows the AI to call one tool and process the result. The default of 8 is enough for most tasks like creating a project with collections.
Lower values prevent the AI from running too many operations in a single response. Higher values allow more complex multi-step operations.
Conversation Memory
Sets how many previous messages the AI keeps in context when responding. The default of 10 (about 5 back-and-forth exchanges) balances context quality with token cost.
Older messages are still visible in the chat history. They just are not sent to the AI provider, so they do not affect the response.
6. Save
Click Save Changes to apply your settings. AI features will be available immediately.