Title: wp_ai_client_prompt
Published: May 20, 2026

---

# wp_ai_client_prompt( string|WordPressAiClientMessagesDTOMessagePart|WordPressAiClientMessagesDTOMessage|array|list|list|null $prompt = null ): 󠀁[WP_AI_Client_Prompt_Builder](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/)󠁿

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#wp--skip-link--target)

Creates a new AI prompt builder using the default provider registry.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#description)󠁿

This is the main entry point for generating AI content in WordPress. It returns 
a fluent builder that can be used to configure and execute AI prompts.

The prompt can be provided as a simple string for basic text prompts, or as more
complex types for advanced use cases like multi-modal content or conversation history.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#parameters)󠁿

 `$prompt`string|WordPressAiClientMessagesDTOMessagePart|WordPressAiClientMessagesDTOMessage
|array|<span class="listlist<string|WordPressAiClientMessagesDTOMessagePart|“>array
>|<span class="list”>list|nulloptional

Initial prompt content.
 A string for simple text prompts, a MessagePart or Message
object for structured content, an array for a message array shape, or a list of 
parts or messages for multi-turn conversations.

Default:`null`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#return)󠁿

 [WP_AI_Client_Prompt_Builder](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/)
The prompt builder instance.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#source)󠁿

    ```php
    function wp_ai_client_prompt( $prompt = null ): WP_AI_Client_Prompt_Builder {
    	return new WP_AI_Client_Prompt_Builder( AiClient::defaultRegistry(), $prompt );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ai-client.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ai-client.php#L60)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ai-client.php#L60-L62)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#related)󠁿

| Uses | Description | 
| [AiClient::defaultRegistry()](https://developer.wordpress.org/reference/classes/wordpress-aiclient-aiclient/defaultregistry/)`wp-includes/php-ai-client/src/AiClient.php` |

Gets the default provider registry instance.

  | 
| [WP_AI_Client_Prompt_Builder::__construct()](https://developer.wordpress.org/reference/classes/wp_ai_client_prompt_builder/__construct/)`wp-includes/ai-client/class-wp-ai-client-prompt-builder.php` |

Constructor.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_ai_client_prompt/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_ai_client_prompt%2F)
before being able to contribute a note or feedback.