> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maxicore.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate AI text content with Maxi AI Core abilities

> Use synchronous and configured text generation abilities to produce content via OpenAI, Anthropic, OpenRouter, and local providers on your Pro plan.

Text generation is a Pro plan feature that lets your AI agent produce content on demand without leaving the MCP session. You call `maxi/generate-text-ai` with a prompt, provider, and model — the plugin routes the request to your chosen provider, waits for the response, and returns the generated text immediately. You can also configure default providers per capability so each call uses the right model without specifying it every time.

<Note>
  Text generation requires a Pro license and an API key for your chosen provider. Set your key first via `maxi/update-ai-settings` — see [Managing AI provider credentials](/security/credentials) for instructions.
</Note>

## Supported providers

<AccordionGroup>
  <Accordion title="OpenAI (GPT)">
    Use any GPT model available on your OpenAI account. Pass `"provider": "openai"` and a `model` slug such as `"gpt-4o-mini"` or `"gpt-4o"`. OpenAI also supports vision tasks through the same provider.
  </Accordion>

  <Accordion title="Anthropic (Claude)">
    Use any Claude model. Pass `"provider": "anthropic"` and a model slug such as `"claude-opus-4-5"` or `"claude-sonnet-4-20250514"`. Anthropic supports text and vision.
  </Accordion>

  <Accordion title="OpenRouter">
    OpenRouter is a multi-model aggregator — one API key gives your agent access to dozens of upstream models from OpenAI, Anthropic, Google, Meta, and others. Pass `"provider": "openrouter"` and use vendor-prefixed model slugs.

    Example model slugs:

    * `openai/gpt-4o-mini`
    * `anthropic/claude-sonnet-4-20250514`
    * `google/gemini-pro-vision`

    <Warning>
      OpenRouter is **explicit-only** in Maxi AI Core — it is never used as an automatic fallback. Always specify `"provider": "openrouter"` directly. This prevents cascade loops where a failed OpenAI call would route back through OpenRouter to OpenAI upstream.
    </Warning>
  </Accordion>

  <Accordion title="Local (self-hosted)">
    Route requests to a self-hosted model running on your own infrastructure. Configure the endpoint via `maxi/update-ai-settings` using the `local_endpoint` field.
  </Accordion>
</AccordionGroup>

## Generate text synchronously

Call `maxi/generate-text-ai` to produce text immediately. The ability blocks until the provider responds and returns the content inline.

<Tabs>
  <Tab title="OpenAI">
    ```json theme={null}
    {
      "prompt": "Write a product description for a standing desk",
      "provider": "openai",
      "model": "gpt-4o-mini"
    }
    ```
  </Tab>

  <Tab title="Anthropic">
    ```json theme={null}
    {
      "prompt": "Write a product description for a standing desk",
      "provider": "anthropic",
      "model": "claude-sonnet-4-20250514"
    }
    ```
  </Tab>

  <Tab title="OpenRouter">
    ```json theme={null}
    {
      "prompt": "Summarize this article in 3 bullet points: ...",
      "provider": "openrouter",
      "model": "anthropic/claude-sonnet-4-20250514"
    }
    ```

    Omitting `model` when using OpenRouter defaults to `openai/gpt-4o-mini`.
  </Tab>
</Tabs>

The response includes the generated text content in the `data` field. Because the call is synchronous, you receive the result immediately without polling.

## Configure default providers

You can set a default provider for each capability type so you do not need to include `provider` in every call. Use `maxi/update-ai-settings` and send only the fields you want to change.

| Setting field     | Controls                                                                       |
| ----------------- | ------------------------------------------------------------------------------ |
| `provider_text`   | Default provider for `maxi/generate-text-ai` and `maxi/generate-text-ai-batch` |
| `provider_vision` | Default provider for vision tasks                                              |

```json theme={null}
{
  "provider_text": "anthropic",
  "openai_org_id": "org-..."
}
```

<Tip>
  Send only the fields you want to change. The ability merges your input with existing settings — unspecified fields are left untouched.
</Tip>

## View current AI settings

Call `maxi/get-ai-settings` to see your current non-credential configuration: default providers per capability, retry tuning, batch/worker settings, HTTP timeout, `openai_org_id`, and `local_endpoint`. API keys are never included in this response — use `maxi/list-provider-keys` to check credential state.

```json theme={null}
{
  "ability": "maxi/get-ai-settings"
}
```

A successful response includes fields such as:

```json theme={null}
{
  "success": true,
  "data": {
    "provider_text": "anthropic",
    "provider_vision": "openai",
    "provider_image": "openai",
    "provider_edit_image": "openai",
    "batch_max_attempts": 3,
    "retry_delay_seconds": 5
  }
}
```

## Related abilities

<CardGroup cols={2}>
  <Card title="Batch text generation" icon="layer-group" href="/abilities/ai-batch">
    Submit multiple prompts as a single background job. Useful for generating content at scale without waiting for each response individually.
  </Card>

  <Card title="Image generation and editing" icon="image" href="/abilities/ai-images">
    Generate and edit images via OpenAI, Replicate, and BFL — with results automatically sideloaded into the WordPress media library.
  </Card>

  <Card title="Managing credentials" icon="key" href="/security/credentials">
    Set, rotate, and audit your provider API keys. Keys are encrypted at rest and validated with a live test call before replacing existing ones.
  </Card>

  <Card title="AI settings reference" icon="gear" href="/security/credentials#per-capability-provider-configuration">
    Configure which provider handles each capability type — text, image, image editing, and vision — independently.
  </Card>
</CardGroup>
