Alpaca Bot
A privately hosted WordPress AI chatbot.
Install in
Alpaca Bot is a chat screen inside WordPress admin, talking to a model you host. Conversations stay on your site, in your own database, and only their author can open them. It runs against Ollama out of the box, or any OpenAI-compatible endpoint.
Features
- A chat screen in wp-admin: replies stream in as they are written, with a copy button on every message and code block, “Edit and resend” on your own, and an image attached from the media library for a model that can see.
- The same chat as a drawer on most other admin screens and as a sidebar in the block editor. The drawer carries the screen it is on, and both carry the post being edited, as chips above the composer; a chip you take off is not sent.
- Your conversations, stored privately on your site (or not at all: the Privacy tab decides) and listed in the screen’s history.
- Switch models per conversation; where the site allows it, your pick is remembered as your default.
- A system prompt, per-model overrides (temperature, context window, keep-alive) and a receipt under every reply: model, tokens, time.
- Monthly usage caps, per site and per user, with the meter behind them.
- Tools the model can call, each switchable: fetch a web page, summarize, write a draft, and the abilities tool, which offers the WordPress abilities an administrator ticks and runs each as the chatting user.
- Remote MCP servers under Settings › Tools: Discover tools lists a server’s tools, and the model is offered the ones you approve; Tools, and what they let the model reach says what that means.
- Settings › Access: who may use the chat, each tool, each MCP server, the settings over REST and the shortcodes, one capability per row, with a note under a row that code sets instead.
- A REST API under
alpaca-bot/v1(docs/api.md) and a WP-CLI command.
Requirements
- PHP 8.4+, WordPress 6.9+, an Ollama instance (or any provider php-agents supports)
Setup
- Install Ollama on your localhost or server.
- In your WordPress admin, open
Alpaca Bot > Settingsand, on the Provider tab, enter the endpoint’s base URL. For Ollama it ends in/v1:http://localhost:11434/v1. - Click
Save Changes. The Models tab then lists what the provider serves; pick a default.
⭐️ Become a Patreon and support Alpaca Bot development. ⭐️
Usage
Read Usage in the README on GitHub.
Shortcodes
Read Shortcodes in the README on GitHub.
Support
Questions and bug reports go to the WordPress.org support forum. Say which plugin, WordPress and PHP versions you run.
For premium support, book a call: video calls, help setting up your Ollama instance or provider, troubleshooting, and onsite setup assistance.
If the plugin has been useful, star Alpaca Bot on GitHub; a star helps other site owners find it.
Made Possible By
- Emma Delaney’s How to Create Your Own ChatGPT in HTML CSS and JavaScript
- Lucide Beautiful & consistent icons – ISC license
- htmx High power tools for HTML – 0BSD license
- league/commonmark Markdown parser for PHP – BSD-3-Clause license
- php-agents Provider-agnostic AI agents for PHP – MIT license
- Ollama Get up and running with large language models locally – MIT license
Written by Joobi from the project's own listing. See the source page
Releases before 0.5.0 are on the releases page.
0.8.0
Alpaca Bot gains an extension API, so small companion plugins can add tools, guard tool calls and extend the chat UI. Nothing changes for a site that adds no companion.
Added
alpaca_bot/loadedfires once Alpaca Bot is ready, with the extension API version (Plugin::API_VERSION, now1).- Every tool call is guarded.
alpaca_bot/tool/before_callcan refuse a call, and the model reads why;alpaca_bot/tool/calledreports each call with its result. They cover built-in tools, abilities, MCP servers and companion toolkits alike.alpaca_bot/mcp/calledstill fires, and on WordPress 7.1+ core’swp_pre_execute_abilitystill applies. - Companion toolkits get their own settings. A plugin that hooks
alpaca_bot/register_toolkitsgets a box under Settings › Tools (off until an administrator ticks it) and its own row in Settings › Access. alpaca_bot/conversation/savedandalpaca_bot/conversation/deleted, for memory, export and retention plugins.- Chat UI hooks through WordPress’s
wp.hooks:alpacaBot.ready,alpacaBot.chat.request,alpacaBot.turn.started,alpacaBot.turn.completed,alpacaBot.turn.failedandalpacaBot.message.rendered. The chat, drawer and editor scripts now loadwp-hooks. - A guide for companion plugins (
docs/extending.md): companions ship WordPress abilities rather than implementing an Alpaca Bot PHP interface.
0.7.0
Alpaca Bot runs on php-agents 0.18.0 and ends a turn cleanly on a refusal, a content filter, a full context window or a broken stream. Tested up to WordPress 7.2.
Changed
- php-agents 0.18.0. The agent reads a provider’s stream as typed events; the site’s generation options and the usage tally reach every tool-turn call through them, on Ollama and through the WordPress AI client. A tool call whose arguments are unparseable, over 4 MiB or nested more than 64 levels deep is dropped instead of run. A turn abandoned mid-reply bills the calls that finished, not the one cut off, since a call now reports its usage when it ends.
- Clean finishes (php-agents 0.17). A refusal is kept as the reply, or says the model declined when it gave no words. A reply a content filter stopped keeps what streamed and says the filter stopped it. A conversation too long for the model fails with a message to start a new one. A stream that broke off, or a
max_tokensstop with no text, fails the turn instead of saving half an answer. No tool runs from a refused, filtered or failed reply, on Ollama or through the WordPress AI client. - Tools refuse arguments their schema does not declare, as php-agents 0.17 does. The
summarizeanddraft-postabilities pass a tool only the arguments it declares, so a toolkit swapped in throughalpaca_bot/toolkitswithoutlengthorpost_typestill works. Apost_statussent todraft_postis refused rather than ignored; a draft is still never published. - Model replies no longer render images. An image loads with no click, so a prompt-injected reply could send the conversation to another site through one. A site that wants them back can add
imgthroughalpaca_bot/render/allowed_tags.
Security
- The
alpaca-bot/chatability answers to the Chat row of Settings › Access, not only toedit_posts, so a role the row leaves out can no longer chat or run tools through the abilities REST route or an MCP adapter. - league/commonmark 2.10.7 and symfony/http-client 8.1.11, for their advisories.
Fixed
- A failed turn says
Provider error:once, not twice. - Plugin Check no longer reads the guarded call to WordPress 7.1’s
wp_prepare_json_schema_for_client()as a hard dependency of a plugin that supports 6.9.
0.6.3
The monthly token cap now holds inside a tool turn.
Changed
- A tool turn re-checks the monthly token cap before each further model call, counting what the turn has spent so far, and so does a turn one of its tools starts (
summarize). Within one request a turn now overshoots a cap by at most the call that crossed it, where it could run the rest of its tool budget past it (Kanboard #4701). - A turn the cap stops keeps its reply so far, stored and billed, and answers with the usual
402 alpaca_bot_cap_exceeded, now saying the reply stopped, withdata.stoppedanddata.conversation_idso a client can find the saved reply.alpaca_bot/chat/failedfires for it with theCapExceeded.wp alpaca-bot chatnames the conversation it was saved on, in plain output and in--json.
Fixed
- The end-to-end tests log in after wp-login’s own focus timer and check both fields before submitting, which a cold CI container could otherwise mix up.
0.6.2
WP-CLI and settings-storage fixes for 0.6.1. Breaking is what an upgrading site may have to act on.
Breaking
- A raw WP-CLI write of
alpaca_bot_settingsgoes through the settings checks.wp option update|set|patch|add alpaca_bot_settingsis now cleaned by the schema, clears the API key when the provider address moves, and checks MCP rows and addresses, however the option’s name reaches WP-CLI: typed, read by--prompt, or awp-cli.ymldefault. A refused row exits non-zero and writes nothing, and so does another spelling the database treats as the same option (Kanboard #4695). - A partial raw
wp option updatekeeps the keys it leaves out, so'{}'no longer resets the settings.wp option patch delete alpaca_bot_settings <key>resets one key, andwp option delete alpaca_bot_settingsresets them all (Kanboard #4695). --autoload=offis refused on that option, since the settings row stays autoloaded;--autoload=onis honoured.
Fixed
- A WP-CLI write that changes only the provider key or an MCP header value reports success, where it stored the value and said “Could not update option” (Kanboard #4696); one that changes nothing once cleaned says it is unchanged, as WP-CLI does.
- When the settings row claims a key that is no longer stored, the settings page, REST and
wp alpaca-bot settingsall show no key (Kanboard #4699). - The cached model list is flushed on every change to the key in use, including a save that clears a key stored before 0.6.1 (Kanboard #4700).
bin/test-integration.sh -- --filter Xworks on a WP Harness site (Kanboard #4697), and the CI step without cURL is named for everything it covers (Kanboard #4698).
0.6.1
Security and reliability fixes for 0.6.0. Breaking is what an upgrading site may have to act on.
Breaking
- Moving the provider’s address clears its API key. Changing
provider.base_urlto another scheme, host or port, on the settings page, overPUT /settingsor with WP-CLI, now drops the stored key unless the same save sends a new one, so a key can no longer follow the address to a host it was never meant for. REST names it in anX-Alpaca-Bot-Cleared: provider.api_keyresponse header, the settings page shows a notice and WP-CLI warns (Kanboard #4539). - The provider API key moved to its own option,
alpaca_bot_provider_key, which is not autoloaded, out ofalpaca_bot_settings, which is. An existing key moves on the first request after the upgrade, and uninstalling removes the new option too. Downgrading to 0.6.0 afterwards sends the masked placeholder instead of the key; upgrading again restores it (Kanboard #4384). - An ability ticked under Settings › Tools may run only other ticked abilities, never Alpaca Bot’s own. An “execute any ability” tool, such as the MCP Adapter’s, could reach an ability that was not ticked, or start a chat turn inside the current one; it is refused now (Kanboard #4538).
wp alpaca-bot settings toolkits.mcp_serversrefuses a row it cannot keep the way REST does, exiting non-zero, naming the row and writing nothing, where it dropped the row silently (Kanboard #4540).
Fixed
- On a host that disables cURL’s functions, the chat and MCP servers use PHP’s own HTTP client instead of failing with a fatal error on the first request (Kanboard #4690).
- A turn whose tools offer nothing, an unreachable MCP server or abilities with none ticked, takes the plain chat path instead of the agent loop (Kanboard #4541).
- Switching conversation while a reply is still arriving no longer sends your next message to another conversation, and a message keeps the context chips and model it was sent with (Kanboard #4525, #4691).
- A message that could not be sent keeps its text in a note above the conversation, instead of overwriting what you typed or landing in another conversation’s box (Kanboard #4692).
- The drawer and the block editor’s sidebar keep their REST nonce fresh from page load, so a tab left open for a day opens the chat without asking for a reload (Kanboard #4526).
- With the chat open in two tabs, the drawer and sidebar reopen the conversation you last used (Kanboard #4693).
- Settings › Access marks a row “set in code” when a filter moves any chat route or either shortcode, not only
POST /chatand[alpacabot], and logs a filter’s error to the debug log (Kanboard #4537, #4694).
Changed
- The block editor’s sidebar reopens the conversation you last had open in it or in the drawer, instead of starting a new chat (Kanboard #4527).
0.6.0
The chat on most admin screens and in the block editor, a capability for each part of the plugin, and tools from the site’s WordPress abilities and from remote MCP servers. Breaking is what an upgrading site, or a client of the REST API, may have to act on.
Breaking
- A tool now needs a Settings › Access row of its own, as well as the chat.
Toolkit\Registry::enabled()drops every toolkit whose row the user fails before thealpaca_bot/toolkitsfilter runs. A default site sees no change:web_fetch,summarizeanddraft_poststart atedit_posts, the capability the chat already asked for. A site that opened the chat to a wider role in code keeps the chat for that role and loses the tools until an administrator lowers a tool’s row, or code opens it withalpaca_bot/capability/tool/{id}.[alpacabot_agent]fetches throughweb_fetch, so it asks that row too (Kanboard #4331). alpaca_bot/admin/menu_capabilitynow decides more than the menu. The users it admits also get the chat launcher on most admin screens and the chat sidebar in the block editor. Both load the chat from a new route,GET /view/panel, and the drawer the launcher opens remembers its state through another,POST /view/drawer; the two routes’ keys,view/panelandview/drawer, start from the Chat row as the other chat routes do. A site that opened the chat to a role in 0.5 by filtering the menu and the 0.5 route keys one by one shows that role a launcher whose chat answers 403 until it also filtersalpaca_bot/capability/view/panelandalpaca_bot/capability/view/drawer, or lowers the Chat row.- The settings capability filter is now two.
GET /settingsandGET /settings/schemaaskalpaca_bot/capability/settings/read,PUT /settingsasksalpaca_bot/capability/settings/write, and both start from what the oldalpaca_bot/capability/settingsreturns, so an existing filter keeps working and can now be split.alpaca_bot/capability/settings/schemais no longer applied: the schema route asks…/settings/readwith the rest of the read.?reveal=1still needsmanage_optionswhatever the filters say. Settings › Access calls these filters, andalpaca_bot/capability/chat, with a request it builds itself, to show whether code has moved a row; that request authorises nothing (Kanboard #4332). - A stream refused because you already have the most running that the site allows answers its own code,
429 alpaca_bot_stream_concurrencywithdata.limit, where it answeredalpaca_bot_rate_limited; the per-minute limit keeps the old code. A client that matched the old code for both now tells them apart, and the chat screen shows the refusal as a warning and gives the message back (Kanboard #4333). web_fetchpins the addresses it checked into the connection, and refuses to fetch where it cannot. It looks a name up once, checks every address, and hands them to cURL (the first alone on a libcurl older than 7.59), for the request and for each redirect, which it now follows itself, up to three. On a server whose PHP would send the request without cURL the tool refuses every fetch rather than connect unpinned, and Tools › Site Health says so (Kanboard #4330, #4483).- A tool name now stays with the first toolkit that offers it. In 0.5 the agent gave a name to the last toolkit that offered it, so a toolkit a site added through
alpaca_bot/toolkitscould take a built-in tool’s name,web_fetchsay, and the model’s calls to it. Now the built-ins, which come first, keep their names, and the site’s tool of the same name is left out without a notice. A filter that puts its own toolkit first in the array it returns keeps the name for it. ErrorsandRateLimitleft theAlpacaBot\Restnamespace, and areAlpacaBot\ErrorsandAlpacaBot\RateLimitnow. Site code that used them fromAlpacaBot\Resthas to move; the REST routes, the hooks and the wire are unchanged.Shortcodes\Chat::CAPABILITYis gone. Who generates a shortcode answer is the Shortcodes row of Settings › Access,edit_postsby default as before, filtered byalpaca_bot/capability/shortcode.- New keys on the wire. Every usage receipt a turn reports carries
tool_result_bytes(onPOST /chat, the stream’sdoneframe andalpaca_bot/usage/recorded), each entry ofmeta.tool_callscarriesresult_bytes, and every streamdeltaframe carriesheld.GET /settingsandGET /settings/schemaanswer eleven more fields (the nineaccess.*rows,toolkits.abilitiesandtoolkits.mcp_servers), andtoolkits.enabledhas anabilitiesoption. APUT /settingsthat drops a moved MCP server’s header value names the server in anX-Alpaca-Bot-Mcp-Clearedresponse header. A client that validated those shapes strictly will see them. - The
alpaca-bot/chatability is annotateddestructive. Storing a turn does more than add to the conversation: it rewrites the conversation’s excerpt, and its title while that is empty or the default, and a transcript past its storage budget drops its oldest images and then its oldest messages. A client of the Abilities API that treats a destructive ability with more care now does so for this one. - Deleting the plugin now deletes what it stored. Uninstalling it from the Plugins screen, or with
wp plugin uninstall, removes its settings, conversations, usage receipts, user preferences, transients and cron event, and what 0.4 left behind, on every site of a network. On a persistent object cache the transients named at run time cannot be listed, so they are left to expire; and while another active plugin registerschat_historyorchat_log, every post of that type stays, the plugin’s own included. Draftsdraft_postwrote are ordinary posts and stay. Deactivating keeps all of it (Kanboard #4431).
Added
- The chat as a drawer on most other admin screens, opened from a button at the bottom right and kept open, on its conversation, from screen to screen, and as a sidebar in the block editor. Both are shown to the users
alpaca_bot/admin/menu_capabilityadmits, and are served by two new routes,GET /view/panelandPOST /view/drawer. - Context chips above the composer: the screen the drawer is on, and the post being edited for a user who may edit it. A chip taken off is not sent, and New chat puts it back.
- Settings › Access, a seventh settings tab with one capability per row: the chat, each tool, each MCP server, reading and writing settings over REST, and the shortcodes. A row that code moves is marked “set in code”; every row but Chat has a filter named after it,
alpaca_bot/capability/tool/web_fetchfor the fetch tool’s, and the Chat row is filtered byalpaca_bot/admin/menu_capabilityand each chat route’s own filter. An Access help tab says what each row decides. - The abilities tool, off by default: the WordPress abilities an administrator ticks under Settings › Tools, offered to the model and run as the chatting user through each ability’s own permission check. Its row starts at administrators, Alpaca Bot’s own abilities are never offered, and a result longer than 8000 characters is cut.
- Remote MCP servers under Settings › Tools: an https address, one header, and a prefix for the server’s tool names,
prefix__tool, which may not end in_, hold__or beability, and is one server’s alone. Each tool is approved one at a time and pinned to a SHA-256 fingerprint of the definition approved, and one the server has since changed is withheld until it is
Follow this listing's changes (Atom feed)