Site Assistant
An AI chat assistant for the visitors of your site, using your own AI key (OpenAI, Anthropic, Groq, OpenRouter, Mistral or Cloudflare Workers AI). You set the model, instructions, topic and limits; visitors only send their question and get the answer. Daily cap protects your AI budget.
Endpoints (6)
Create an AI assistant for site visitors. It uses the AI integration of this project, so the key of the chosen provider must be in the vault (openai: openai_api_key, anthropic: aapi_anthropic_key, groq: groq_api_key, openrouter, mistral, cloudflare-workers-ai: see their integration). Visitors can never change the model, instructions or limits. scope sets how broadly it may answer: "strict" (default) only about topic, "related" also briefly about closely related questions, "open" anything. Do NOT put secrets, internal prices or private data in system_prompt: a determined visitor may get the model to reveal it. After creating, call test-assistant once to check it works.
| Field | Type | Required | Description |
|---|---|---|---|
assistant_key |
string | ✓ Yes | Short id, lowercase letters, digits, - and _. Example: "help". |
label |
string | ✓ Yes | Human-readable name. |
provider |
string | ✓ Yes | "openai", "anthropic", "groq", "openrouter", "mistral" or "cloudflare-workers-ai". |
model |
string | ✓ Yes | Model id of that provider, e.g. "gpt-4o-mini", "claude-haiku-4-5-20251001", "llama-3.1-8b-instant". |
system_prompt |
string | ✓ Yes | Instructions for the assistant: who it is, what it knows about the site, tone. Max 8000 characters. |
access |
string | ✓ Yes | "anonymous" (any visitor) or "verified" (signed-in visitors or tenants only). No default: choose deliberately. |
scope |
string | No | "strict" (default), "related" or "open". |
topic |
string | No | What the assistant is about, e.g. "our hiking routes, bookings and opening hours". Required unless scope is "open". |
off_topic_reply |
string | No | Fixed reply for questions outside the topic. Empty: the assistant politely says in the visitor's language what it can help with. |
max_output_tokens |
integer | No | Max length of one answer (1-4000). Default 500. |
temperature |
number | No | 0-1, default 0.7. Not applied for provider "openai". |
max_input_chars |
integer | No | Max characters per visitor message (1-8000). Default 1000. |
max_history_messages |
integer | No | How many earlier messages are sent along for context (0-40). Default 10. |
per_session_hourly |
integer | No | Max messages per visitor (session, or email when verified) per hour (1-1000). Default 30. |
per_ip_hourly |
integer | No | Anonymous only: max messages per IP address per hour (0 = off, max 1000). Default 60. |
daily_cap |
integer | No | Budget brake: max answers per day (UTC) for this assistant, all visitors together (1-100000). Default 500. After that visitors see fallback_message. |
fallback_message |
string | No | What visitors see when a limit is reached or the AI provider fails. Default: "The assistant is not available right now. Please try again later." |
Change an assistant. Only send what changes. Send an empty string for topic or off_topic_reply to clear it. Set is_active false to pause (visitors then see fallback_message).
| Field | Type | Required | Description |
|---|---|---|---|
assistant_key |
string | ✓ Yes | |
label |
string | No | |
provider |
string | No | |
model |
string | No | |
system_prompt |
string | No | |
access |
string | No | |
scope |
string | No | |
topic |
string | No | |
off_topic_reply |
string | No | |
max_output_tokens |
integer | No | |
temperature |
number | No | |
max_input_chars |
integer | No | |
max_history_messages |
integer | No | |
per_session_hourly |
integer | No | |
per_ip_hourly |
integer | No | |
daily_cap |
integer | No | |
fallback_message |
string | No | |
is_active |
boolean | No |
Delete an assistant permanently. To pause it instead, use update-assistant with is_active false.
| Field | Type | Required | Description |
|---|---|---|---|
assistant_key |
string | ✓ Yes |
All assistants of this project with their settings, today's number of answers against daily_cap, whether the provider key is in the vault, and the platform limits.
No input parameters required.
Send one test message with exactly the visitor settings (instructions, scope, limits) and see the answer, or the error from the AI provider. Counts towards daily_cap. Use this after create or update.
| Field | Type | Required | Description |
|---|---|---|---|
assistant_key |
string | ✓ Yes | |
message |
string | ✓ Yes | |
history |
array | No | Optional earlier messages, same format as chat. |
The current visitor asks the assistant a question. Returns {reply, limited}. When limited is true, reply holds the fallback message and reason says why ("daily_limit", "visitor_limit", "network_limit", "inactive", "unavailable"). For a conversation, the page keeps the earlier messages itself and sends them as history; nothing is stored on the server.
| Field | Type | Required | Description |
|---|---|---|---|
assistant_key |
string | ✓ Yes | |
message |
string | ✓ Yes | The visitor's question. The assistant's own max_input_chars applies. |
history |
array | No | Earlier messages of this conversation, oldest first: [{"role":"user","content":"..."},{"role":"assistant","content":"..."}]. Only user and assistant roles are used. |
MCP Tool Names
When using this integration through an AI assistant (Claude, ChatGPT, Cursor, etc.), the endpoints are available as MCP tools:
| Endpoint | MCP Tool Name |
|---|---|
| create-assistant | site-assistant_create_assistant |
| update-assistant | site-assistant_update_assistant |
| delete-assistant | site-assistant_delete_assistant |
| get-config | site-assistant_get_config |
| test-assistant | site-assistant_test_assistant |
| chat | site-assistant_chat |
Website