@mattwiebe/wp-home-inference
v0.1.5
Published
CLI and WordPress plugin for routing AI inference to models running on your own machine.
Readme
Home Inference
Home Inference is a WordPress AI provider plugin plus a small local proxy for running inference against models on your own machine.
It is built for WordPress 7.0+ and the new Connectors primitives. The WordPress plugin runs on the remote site. The local proxy runs on a machine you control, talks to an OpenAI-compatible local backend such as Ollama or LM Studio, and exposes that backend to WordPress through an authenticated Tailscale Funnel.
What It Does
- Registers a
home-inferenceAI provider with the WordPress AI Client. - Adds a Settings screen for entering the proxy URL, API key, and selected model.
- Loads model choices from the real proxied
/v1/modelsendpoint. - Restricts the provider to the selected model so WordPress auto-discovery consistently uses it.
- Ships a local
nodeproxy that can:- detect local backends,
- persist configuration in
local/.env, - expose the proxy through Tailscale Funnel,
- protect requests with a bearer token.
Repository Layout
plugin.php: WordPress plugin bootstrap, settings UI, connector registration.src/: provider, model, and metadata directory classes.local/server.mjs: local proxy and Tailscale Funnel entrypoint.
Requirements
- WordPress
7.0+ - PHP
7.4+ - Node.js
18+with nativefetch - One local OpenAI-compatible backend, currently tested against:
- Ollama
- LM Studio
- Tailscale, if you want public exposure through Funnel
WordPress Plugin Setup
- Copy this plugin into
wp-content/plugins/wp-home-inference. - Activate the plugin in WordPress.
- Open
Settings > Home Inference. - Enter:
- the proxy endpoint URL,
- the shared API key,
- the model to expose to WordPress.
The Connectors screen links back to this setup page.
Local Proxy Setup
Preferred install path:
npm install -g @mattwiebe/wp-home-inferenceThen initialize and run the proxy with:
wphi init
wphi upmacOS background service management:
wphi install
wphi start
wphi stop
wphi status
wphi rotate-key
wphi uninstallYou can also run it without a global install:
npx @mattwiebe/wp-home-inference init
npx @mattwiebe/wp-home-inference upFor local development from this repo, you can still use:
npm run init
npm run up
npm run service:install
npm run start
npm run stop
npm run status
npm run rotate-key
npm run service:uninstallThat guided setup will:
- detect or prompt for the backend URL,
- generate or accept an API key,
- ask whether to enable Tailscale Funnel,
- ask which public Funnel port to use, defaulting to
8443, - save everything into
local/.env.
After that, normal startup is non-interactive:
wphi upTo reconfigure later:
wphi initOn macOS, wphi install or npm run service:install writes a LaunchAgent at ~/Library/LaunchAgents/com.mattwiebe.wp-home-inference.plist so the proxy can keep running in the background across logins.
To rotate the shared API key in the persisted .env file and print the new key:
wph rotate-keyThis also works as:
wphi rotate-key
npm run rotate-keyOn macOS, if the LaunchAgent is currently running, rotate-key will restart it automatically so the background process picks up the new key immediately.
Useful overrides:
wphi up --port 13531
wphi up --funnel-port 10000
wphi up --backend http://localhost:11434
wphi up --api-key your-secret
wphi up --no-tunnelPorts
- Local proxy port defaults to
13531. - Tailscale Funnel public port defaults to
8443. - Allowed Funnel public ports are
443,8443, and10000.
Important: the public Funnel URL usually does not use the same port as the local proxy. Tailscale listens on the selected public port and forwards traffic to the local proxy port.
Local Smoke Test
Once the proxy is running:
curl -H "Authorization: Bearer <api-key>" http://127.0.0.1:13531/v1/modelsDevelopment
Install project tooling:
composer install
npm ciInstall the WordPress PHPUnit test suite:
composer test:install-wpThe PHP tests use the real WordPress test framework and WP_UnitTestCase, so they need a local MySQL database plus the WordPress test library installed by that script.
Run the local checks:
composer lint
composer test
npm run lint
npm testCut a release from the repo:
npm run releaseThis command:
- verifies version alignment between
package.jsonandplugin.php - requires a clean
mainbranch worktree - if the target tag already exists, offers to bump to the next patch semver and continue
- runs PHP lint plus Node verification
- builds the plugin ZIP and npm tarball
- creates and pushes the git tag
- waits for the GitHub Release workflow to publish release assets
- reports whether Packagist notification is configured in GitHub secrets
Because npm publish is manual in this repo due OTP requirements, the default release command stops short of publishing to npm and prints the exact next command.
If you want the command to publish to npm too, opt in explicitly:
npm run release -- --publish-npm --otp <code>Build a release ZIP locally:
npm run build:pluginThat creates:
dist/wp-home-inference-plugin.zipBuild the npm package tarball locally:
npm run build:npmThat creates:
dist/mattwiebe-wp-home-inference-<version>.tgzGitHub Automation
This repository ships with GitHub Actions workflows for:
- CI on pushes and pull requests
- PHP lint + real WordPress
WP_UnitTestCasetests - Node syntax check + Node tests
- PHP lint + real WordPress
- Release packaging on tags matching
v*- runs the full test suite,
- builds the WordPress plugin ZIP and npm tarball,
- uploads both artifacts to the GitHub release.
To cut a release:
- Make sure
package.jsonand the plugin header version are aligned. - Create and push a semver tag like
v0.1.4. - GitHub Actions will build:
dist/wp-home-inference-plugin.zipdist/mattwiebe-wp-home-inference-<version>.tgz
- The workflow will attach both files to the GitHub release automatically.
For Packagist auto-refresh after tag pushes, add these repository secrets in GitHub:
PACKAGIST_USERNAMEPACKAGIST_API_TOKEN
The release workflow will call Packagist's documented update endpoint after publishing the GitHub release. Reference: Packagist update hooks.
Composer / Packagist
This repository is ready to be consumed as a Composer package from Packagist or directly from GitHub.
The package name is:
mattwiebe/wp-home-inferenceIt uses Composer package type wordpress-plugin, so Composer-based WordPress projects can install it into wp-content/plugins when the root project uses composer/installers with the usual installer paths.
Example root project setup:
{
"require": {
"composer/installers": "^2.3",
"mattwiebe/wp-home-inference": "^0.1"
},
"extra": {
"installer-paths": {
"wp-content/plugins/{$name}/": ["type:wordpress-plugin"]
}
}
}If you want to consume it directly from GitHub before Packagist metadata refreshes or before tagging, add a VCS repository in the root project:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mattwiebe/wp-home-inference"
}
]
}WP Packages Compatibility
WP Packages mirrors active plugins and themes from the WordPress.org directory under names like wp-plugin/plugin-name. Because Home Inference is hosted on GitHub and is not currently in the WordPress.org plugin directory, it will not appear there yet.
The repo is still compatible with the same Composer install flow described in the WP Packages docs:
- it uses Composer package type
wordpress-plugin - it sets a stable installer name of
wp-home-inference - it works with the same root-level
composer/installersconfiguration used for WP Packages packages
So the practical path today is mattwiebe/wp-home-inference via Packagist or a VCS repository. If the plugin is later published to WordPress.org, then a WP Packages entry would become possible under a wp-plugin/... package name.
npm Package
The npm package name is:
@mattwiebe/wp-home-inferencePreferred usage:
npm install -g @mattwiebe/wp-home-inference
wphi init
wphi upThe CLI also exposes macOS service management:
wphi install
wphi start
wphi stop
wphi status
wphi uninstallIt also works without installation:
npx @mattwiebe/wp-home-inference up
npx @mattwiebe/wp-home-inference initThe package also exposes wp-home-inference as a longer alias, but wphi is the intended global command.
For convenience, the package also exposes the shorter wph alias.
The npm CLI stores its persistent config in:
~/.config/wp-home-inference/.envThat keeps npx usage stateful across runs instead of writing config into a temporary install directory.
Publishing To npm
Based on npm’s current docs for scoped public packages, the publish flow is:
- Create or sign in to your npm account with
npm login. - Make sure the package name is available:
npm view @mattwiebe/wp-home-inference - Inspect exactly what would be published:
npm pack --dry-run - Publish the next version:
npm publish
This repo already sets publishConfig.access to public, which is the required setting for a public scoped package according to npm’s docs.
Current Status
This project is early, but the core loop is in place:
- provider registration works,
- settings save with nonce/capability protection via the WordPress Settings API,
- API key handling preserves secrets as opaque values,
- model choices come from the live proxy,
- local proxy configuration persists in
local/.env.
License
GPL-2.0-or-later
