PHPackages                             fendinger/kirby-visitor-ai-chat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. fendinger/kirby-visitor-ai-chat

ActiveKirby-plugin[API Development](/categories/api)

fendinger/kirby-visitor-ai-chat
===============================

AI site search as a chat widget for Kirby CMS.

1.0.0(1mo ago)40proprietaryPHP

Since May 27Pushed 3w ago1 watchersCompare

[ Source](https://github.com/fendinger/kirby-visitor-ai-chat)[ Packagist](https://packagist.org/packages/fendinger/kirby-visitor-ai-chat)[ RSS](/packages/fendinger-kirby-visitor-ai-chat/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Kirby Visitor AI Chat](https://private-user-images.githubusercontent.com/41189281/616285982-a6ed8aaa-317e-414d-8b9a-165c62498f22.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODQzNTMzNDksIm5iZiI6MTc4NDM1MzA0OSwicGF0aCI6Ii80MTE4OTI4MS82MTYyODU5ODItYTZlZDhhYWEtMzE3ZS00MTRkLThiOWEtMTY1YzYyNDk4ZjIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzE4VDA1MzcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxODg1Njk0ZDE1ZjI2Mjg1NTFjZGI2NDQwZmQ4ZWZlOTE3Njg5MGM2YThmNzI2ZTc3ZWIzNGU3N2FjN2VmNDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.Uim0wi5SH4NUfr5yYiAb30j0A3bR5C3LGW6R44qztwM)](https://private-user-images.githubusercontent.com/41189281/616285982-a6ed8aaa-317e-414d-8b9a-165c62498f22.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODQzNTMzNDksIm5iZiI6MTc4NDM1MzA0OSwicGF0aCI6Ii80MTE4OTI4MS82MTYyODU5ODItYTZlZDhhYWEtMzE3ZS00MTRkLThiOWEtMTY1YzYyNDk4ZjIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzE4VDA1MzcyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxODg1Njk0ZDE1ZjI2Mjg1NTFjZGI2NDQwZmQ4ZWZlOTE3Njg5MGM2YThmNzI2ZTc3ZWIzNGU3N2FjN2VmNDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.Uim0wi5SH4NUfr5yYiAb30j0A3bR5C3LGW6R44qztwM)Kirby Visitor AI Chat
=====================

[](#kirby-visitor-ai-chat)

Intelligent site search as a chat widget for Kirby CMS. Content is indexed as embeddings and visitor questions are answered via RAG (Retrieval-Augmented Generation).

Five supported providers: **OpenAI**, **Mistral**, **Google Gemini**, **IONOS AI Model Hub**, **Mittwald AI Hosting** — freely configurable for embeddings and chat responses.

> **Using this plugin incurs costs.** All supported providers charge for API usage (embeddings during indexing, chat completions per visitor question). In practice, costs are usually only a few cents per month for small to medium sites with moderate traffic — but this depends on site size, chosen models, and visitor volume. You are solely responsible for usage and billing with your provider. The plugin includes local token/cost tracking (see [Cost and token tracking](#cost-and-token-tracking)) and configurable rate limits, but does **not** enforce hard spending caps — set budget alerts and usage limits in your provider's dashboard.

Installation
------------

[](#installation)

### Composer

[](#composer)

```
composer require fendinger/kirby-visitor-ai-chat

```

### Manual

[](#manual)

Download and copy this repository to `/site/plugins/kirby-visitor-ai-chat`.

Configuration
-------------

[](#configuration)

In `site/config/config.php`:

```
return [
    'fendinger.visitor-ai-chat' => [
        'providers' => [
            'embedding' => 'openai',   // openai | mistral | gemini | ionos | mittwald
            'chat'      => 'openai',
        ],
        'openai'   => ['apiKey' => 'sk-...'],
        'mistral'  => ['apiKey' => '...'],
        'gemini'   => ['apiKey' => '...'],
        'ionos'    => ['apiKey' => '...'],
        'mittwald' => ['apiKey' => '...'],

        // Optional:
        'ui' => ['locale' => 'de'],    // null = auto
        'rateLimit' => ['perMinute' => 10, 'perHour' => 60],
        'chunk' => ['size' => 800, 'overlap' => 120],
        'topK' => 5,
        'maxQuery' => 500,
        'include' => [
            'templates' => [],  // empty = all templates; otherwise whitelist
        ],
        'exclude' => [
            'pages' => [],      // page IDs that are never indexed
        ],
        'crawler' => [
            'maxPages'   => 2000,    // safety upper bound
            'timeout'    => 10,      // seconds for sitemap fetch
            'useSitemap' => true,    // use sitemap.xml as additional seed
        ],
    ],
];
```

### Getting API keys

[](#getting-api-keys)

You need an API key from at least one provider. Embedding and chat providers can be the same or different.

- **OpenAI** — Sign up at [platform.openai.com](https://platform.openai.com/), then create a key at [platform.openai.com/api-keys](https://platform.openai.com/api-keys). Requires a funded billing account. Set budget alerts under [Billing → Limits](https://platform.openai.com/account/limits).
- **Mistral** — Sign up at [console.mistral.ai](https://console.mistral.ai/), then create a key at [console.mistral.ai/api-keys](https://console.mistral.ai/api-keys/). Free tier available for testing; paid plan required for production usage.
- **Google Gemini** — Sign up at [aistudio.google.com](https://aistudio.google.com/), then create a key at [aistudio.google.com/apikey](https://aistudio.google.com/apikey). Generous free tier for Gemini 1.5 Flash; paid plan available via Google Cloud.
- **IONOS AI Model Hub** — Sign up at [cloud.ionos.com](https://cloud.ionos.com/), enable the AI Model Hub and create a token. Hosted in EU data centers (Frankfurt). Pay-as-you-go pricing per token; see the IONOS dashboard for current rates.
- **Mittwald AI Hosting** — Available to mittwald customers via [mStudio](https://studio.mittwald.de/). Create an OpenAI-compatible API key per organization. All models are hosted in German data centers (GDPR-friendly, no training data retention). Billing is per provisioned model slot, not per token — see mStudio for current plans.

Paste the key into `site/config/config.php` as shown above. Make sure `config.php` is not committed to a public repository.

### Initial reindex

[](#initial-reindex)

Before the widget can answer, the site must be indexed once. In the Panel under **Visitor AI Chat** (menu entry), click „Run full reindex". Statistics (reachable pages, chunks, last crawl) are shown on the same page.

Alternatively via PHP CLI:

```
php -r 'require "kirby/bootstrap.php"; $kirby = new Kirby\Cms\App(); print_r((new Fendinger\VisitorAiChat\Indexer())->indexAll());'
```

Subsequent content changes are picked up automatically (see [Automatic updates](#automatic-updates)).

### Embedding the widget

[](#embedding-the-widget)

The plugin ships a snippet that renders the chat widget. Include it in your site template (typically `site/snippets/footer.php` or wherever you want the floating button to appear):

```
