Title: WP_AI_Client_HTTP_Client::__construct
Published: May 20, 2026

---

# WP_AI_Client_HTTP_Client::__construct( WordPressAiClientDependenciesPsrHttpMessageResponseFactoryInterface $response_factory, WordPressAiClientDependenciesPsrHttpMessageStreamFactoryInterface $stream_factory )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_ai_client_http_client/__construct/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_ai_client_http_client/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_ai_client_http_client/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_http_client/__construct/?output_format=md#changelog)

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

Constructor.

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

 `$response_factory`WordPressAiClientDependenciesPsrHttpMessageResponseFactoryInterfacerequired

PSR-17 Response factory.

`$stream_factory`WordPressAiClientDependenciesPsrHttpMessageStreamFactoryInterfacerequired

PSR-17 Stream factory.

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

    ```php
    public function __construct( ResponseFactoryInterface $response_factory, StreamFactoryInterface $stream_factory ) {
    	$this->response_factory = $response_factory;
    	$this->stream_factory   = $stream_factory;
    }
    ```

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

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

| Used by | Description | 
| [WP_AI_Client_Discovery_Strategy::createClient()](https://developer.wordpress.org/reference/classes/wp_ai_client_discovery_strategy/createclient/)`wp-includes/ai-client/adapters/class-wp-ai-client-discovery-strategy.php` |

Creates an instance of the WordPress HTTP client.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ai_client_http_client/__construct/?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%2Fclasses%2Fwp_ai_client_http_client%2F__construct%2F)
before being able to contribute a note or feedback.