Title: HttpTransporter::buildGuzzleOptions
Published: May 20, 2026

---

# HttpTransporter::buildGuzzleOptions( WordPressAiClientProvidersHttpDTORequestOptions $options ): WordPressAiClientProvidersHttparray<string,

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Converts request options to a Guzzle-compatible options array.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#parameters)󠁿

 `$options`WordPressAiClientProvidersHttpDTORequestOptionsrequired

The request options.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#return)󠁿

 WordPressAiClientProvidersHttparray<string, mixed> Guzzle-compatible options.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#source)󠁿

    ```php
    private function buildGuzzleOptions(RequestOptions $options): array
    {
        $guzzleOptions = [];
        $timeout = $options->getTimeout();
        if ($timeout !== null) {
            $guzzleOptions['timeout'] = $timeout;
        }
        $connectTimeout = $options->getConnectTimeout();
        if ($connectTimeout !== null) {
            $guzzleOptions['connect_timeout'] = $connectTimeout;
        }
        $allowRedirects = $options->allowsRedirects();
        if ($allowRedirects !== null) {
            if ($allowRedirects) {
                $redirectOptions = [];
                $maxRedirects = $options->getMaxRedirects();
                if ($maxRedirects !== null) {
                    $redirectOptions['max'] = $maxRedirects;
                }
                $guzzleOptions['allow_redirects'] = !empty($redirectOptions) ? $redirectOptions : \true;
            } else {
                $guzzleOptions['allow_redirects'] = \false;
            }
        }
        return $guzzleOptions;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/src/providers/http/httptransporter.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php#L197)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php#L197-L222)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#related)󠁿

| Used by | Description | 
| [HttpTransporter::sendWithGuzzle()](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/sendwithguzzle/)`wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php` |

Sends a request using a Guzzle-compatible client.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-http-httptransporter/buildguzzleoptions/?output_format=md#changelog)󠁿

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

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwordpress-aiclient-providers-http-httptransporter%2Fbuildguzzleoptions%2F)
before being able to contribute a note or feedback.