Legion AI Connect for WordPress
Add AI chat to WordPress with visitor-funded usage and a configurable owner margin. No site-wide AI provider key is required.
Requires WordPress 6.3 or later and PHP 7.4 or later.
Installation
- 01Install Legion AI Connect from the WordPress.org plugin directory.
- 02In WordPress Admin, open Plugins > Add New and search for Legion AI Connect.
- 03Install, activate the plugin, and open Settings > Legion AI.
- 04Create a WordPress app in the Legion Developer Dashboard and copy its Client ID.
- 05Add the Legion AI Chat block, Elementor widget, or [legion_chat] shortcode to a page.
Integration options
The plugin includes a Gutenberg block, an Elementor widget, the [legion_chat] shortcode, and fixed or inline display modes. Site owners can configure the greeting, accent color, position, theme, per-widget context IDs, and inline pasted context for article-specific chats.
Readable source code
The distributed plugin ZIP contains the human-readable JavaScript SDK source, license, package manifest, and Vite build configuration under source/legion-sdk/. The generated runtime bundle is assets/legion-sdk.min.js.
Node.js 20 or later is recommended. The rebuilt browser bundle is written to source/legion-sdk/dist/legion-sdk.min.js for comparison with the distributed asset.
External services and privacy
Legion AI Connect depends on the Legion AI service for visitor authorization, usage billing, AI request routing, usage calculation, and generated responses. The plugin does not provide AI responses without this service.
After the site owner configures a Client ID and a visitor chooses to connect or chat, the visitor's browser may contact https://legion-ai.org/connect for authorization, https://auth.legion-ai.org for token exchange and refresh, and https://api.legion-ai.org for AI chat requests.
Data sent can include the configured Client ID, OAuth authorization code, access and refresh tokens, visitor chat messages, optional inline widget context, selected context IDs, selected model options, and technical request metadata needed to secure, process, meter, and bill the request. Legion may use third-party AI model and infrastructure providers as described in its policies.
The plugin does not store visitor chat transcripts or Legion tokens in the WordPress database. Inline widget context is scoped to the rendered widget and is not added to persistent Legion knowledge by the plugin. Access and refresh tokens are stored in the visitor's browser local storage, while temporary OAuth state and pending draft text during reauthorization are stored in session storage.
Redirect
The redirect URI is generated automatically. Verify it matches the URI shown in the plugin settings; update it on your dashboard only if they differ.