Zactonz AI Connector for xAI Grok

v1.0.0

xAI Grok connector for the WordPress AI Client. Grok text, vision, tool calling, structured output with a real JSON schema, reasoning effort and image generation, with each model's modalities read from xAI's own catalogue.

WordPress 7.0+PHP 7.4+An xAI account and API key Updated 22 Oct 2026

Installation & setup

Install the plugin#

This connector is awaiting review for the WordPress plugin directory. The directory steps below are the route once it is listed; until then, install it from the plugin zip.

From the dashboard, go to Plugins › Add New, search for Zactonz AI Connector for xAI Grok and click Install Now, then Activate. WordPress also links here directly from Settings › Connectors when it needs a connector that is not installed yet.

With WP-CLI:

wp plugin install zactonz-ai-connector-for-xai-grok --activate

To install manually, upload the folder to /wp-content/plugins/zactonz-ai-connector-for-xai-grok/ and activate it from the Plugins menu.

Connect to xAI#

  1. Create an API key in the xAI console.
  2. Go to Settings › Connectors and paste the key into the xAI Grok connector.
  3. Go to Settings › xAI Grok to review the discovered models and choose a default model per capability, a reasoning level for the default text model, and the request timeouts.

The key is stored in the option WordPress registers for the connector, so the Connectors screen and the connector's own settings screen always show the same credential.

Keep the key out of the database#

Define XAI_API_KEY in wp-config.php, or set an environment variable of the same name. When either is present the connector uses it, the settings field is disabled, and nothing is written to the database.

define( 'XAI_API_KEY', '…' );

Choosing a default model#

The picker lists the Grok chat and image models your account can reach, each with the input and output modalities xAI reports. Video and voice models are not listed, because the WordPress AI Client has no contract for them. Choose a default per capability, or leave the choice to the AI Client, which picks the first suitable model in the list.

Reasoning effort#

Settings › xAI Grok has a reasoning control that applies to the default text model; it is sent only with requests to that model and left off every other request. The levels offered are exactly the ones xAI documents, and Model default leaves the parameter off. The highest level is accepted only on xAI's newer models and treated as the next level down elsewhere, as xAI's documentation describes. Which levels a model accepts is up to xAI, so a model that does not reason, or that does not accept the level chosen, may ignore or refuse it. A reasoning reply takes longer to arrive, so raise the request timeout if you ask for long answers at the highest level.

Image generation#

Grok's image models are offered to the WordPress AI Client's image generation capability and are called through xAI's image generation endpoint rather than chat. Choose a default image model in Settings › xAI Grok, and set the image timeout separately from the text timeout, since an image takes longer to produce than a sentence.

Use a proxy or gateway#

Settings › xAI Grok has an API base URL field. Leave it empty to use https://api.x.ai/v1, or point it at a gateway that speaks the same API.

AI features reach the gateway through the WordPress AI Client, which sends every request with wp_safe_remote_request(). WordPress refuses such requests to loopback and private network addresses and to any port other than 80, 443 and 8080, so a gateway on a LAN address or a non-standard port will not work unless the site allows that host with the http_request_host_is_external filter. The connector's own connection check and Site Health test do not apply that restriction, so with such a gateway they can report a healthy connection while AI features still cannot reach it. Use a public hostname on a standard port, or add the filter.

Check the connection#

Tools › Site Health includes a connectivity test for xAI Grok, which runs in the background so it never holds the screen open. Settings › xAI Grok has a diagnostics button that reports the endpoint, HTTP status, latency, the number of discovered models, any configured defaults missing from the current catalogue, and the AI Client version. The key never appears in the report.