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

---

# ProviderMetadata::__construct( string $id, string $name, WordPressAiClientProvidersEnumsProviderTypeEnum $type, string|null $credentialsUrl = null, WordPressAiClientProvidersHttpEnumsRequestAuthenticationMethod|null $authenticationMethod = null, string|null $description = null, string|null $logoPath = null )

## In this article

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

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

Constructor.

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

 `$id`stringrequired

The provider’s unique identifier.

`$name`stringrequired

The provider’s display name.

`$type`WordPressAiClientProvidersEnumsProviderTypeEnumrequired

The provider type.

`$credentialsUrl`string|nulloptional

The URL where users can get credentials.

Default:`null`

`$authenticationMethod`WordPressAiClientProvidersHttpEnumsRequestAuthenticationMethod
|nulloptional

The authentication method.

Default:`null`

`$description`string|nulloptional

The provider’s description.

Default:`null`

`$logoPath`string|nulloptional

The full path to the provider’s logo image file.

Default:`null`

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

    ```php
    public function __construct(string $id, string $name, ProviderTypeEnum $type, ?string $credentialsUrl = null, ?RequestAuthenticationMethod $authenticationMethod = null, ?string $description = null, ?string $logoPath = null)
    {
        if (!preg_match('/^[a-z0-9\-_]+$/', $id)) {
            throw new InvalidArgumentException(sprintf(
                // phpcs:ignore Generic.Files.LineLength.TooLong
                'Invalid provider ID "%s". Only lowercase alphanumeric characters, hyphens, and underscores are allowed.',
                $id
            ));
        }
        $this->id = $id;
        $this->name = $name;
        $this->description = $description;
        $this->type = $type;
        $this->credentialsUrl = $credentialsUrl;
        $this->authenticationMethod = $authenticationMethod;
        $this->logoPath = $logoPath;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/php-ai-client/src/providers/dto/providermetadata.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/php-ai-client/src/Providers/DTO/ProviderMetadata.php#L85)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/php-ai-client/src/Providers/DTO/ProviderMetadata.php#L85-L101)

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

| Used by | Description | 
| [ProviderMetadata::fromArray()](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-dto-providermetadata/fromarray/)`wp-includes/php-ai-client/src/Providers/DTO/ProviderMetadata.php` |

{@inheritDoc}

  |

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

| Version | Description | 
| [1.3.0](https://developer.wordpress.org/reference/since/1.3.0/) | Added optional $logoPath parameter. | 
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Added optional $description parameter. | 
| [0.1.0](https://developer.wordpress.org/reference/since/0.1.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-dto-providermetadata%2F__construct%2F)
before being able to contribute a note or feedback.