Title: ModelMetadata
Published: May 20, 2026

---

# class ModelMetadata {}

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#description)
 * [Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#changelog)

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

Represents metadata about an AI model.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#description)󠁿

This class contains information about a specific AI model, including its identifier,
display name, supported capabilities, and configuration options.

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/?output_format=md#methods)󠁿

| Name | Description | 
| [ModelMetadata::__clone](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/__clone/) | Performs a deep clone of the model metadata. | 
| [ModelMetadata::__construct](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/__construct/) | Constructor. | 
| [ModelMetadata::fromArray](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/fromarray/) | {@inheritDoc} | 
| [ModelMetadata::getId](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/getid/) | Gets the model’s unique identifier. | 
| [ModelMetadata::getJsonSchema](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/getjsonschema/) | {@inheritDoc} | 
| [ModelMetadata::getName](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/getname/) | Gets the model’s display name. | 
| [ModelMetadata::getSupportedCapabilities](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/getsupportedcapabilities/) | Gets the model’s supported capabilities. | 
| [ModelMetadata::getSupportedOptions](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/getsupportedoptions/) | Gets the model’s supported configuration options. | 
| [ModelMetadata::toArray](https://developer.wordpress.org/reference/classes/wordpress-aiclient-providers-models-dto-modelmetadata/toarray/) | {@inheritDoc} |

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

    ```php
    class ModelMetadata extends AbstractDataTransferObject
    {
        public const KEY_ID = 'id';
        public const KEY_NAME = 'name';
        public const KEY_SUPPORTED_CAPABILITIES = 'supportedCapabilities';
        public const KEY_SUPPORTED_OPTIONS = 'supportedOptions';
        /**
         * @var string The model's unique identifier.
         */
        protected string $id;
        /**
         * @var string The model's display name.
         */
        protected string $name;
        /**
         * @var list<CapabilityEnum> The model's supported capabilities.
         */
        protected array $supportedCapabilities;
        /**
         * @var list<SupportedOption> The model's supported configuration options.
         */
        protected array $supportedOptions;
        /**
         * Constructor.
         *
         * @since 0.1.0
         *
         * @param string $id The model's unique identifier.
         * @param string $name The model's display name.
         * @param list<CapabilityEnum> $supportedCapabilities The model's supported capabilities.
         * @param list<SupportedOption> $supportedOptions The model's supported configuration options.
         *
         * @throws InvalidArgumentException If arrays are not lists.
         */
        public function __construct(string $id, string $name, array $supportedCapabilities, array $supportedOptions)
        {
            if (!array_is_list($supportedCapabilities)) {
                throw new InvalidArgumentException('Supported capabilities must be a list array.');
            }
            if (!array_is_list($supportedOptions)) {
                throw new InvalidArgumentException('Supported options must be a list array.');
            }
            $this->id = $id;
            $this->name = $name;
            $this->supportedCapabilities = $supportedCapabilities;
            $this->supportedOptions = $supportedOptions;
        }
        /**
         * Gets the model's unique identifier.
         *
         * @since 0.1.0
         *
         * @return string The model ID.
         */
        public function getId(): string
        {
            return $this->id;
        }
        /**
         * Gets the model's display name.
         *
         * @since 0.1.0
         *
         * @return string The model name.
         */
        public function getName(): string
        {
            return $this->name;
        }
        /**
         * Gets the model's supported capabilities.
         *
         * @since 0.1.0
         *
         * @return list<CapabilityEnum> The supported capabilities.
         */
        public function getSupportedCapabilities(): array
        {
            return $this->supportedCapabilities;
        }
        /**
         * Gets the model's supported configuration options.
         *
         * @since 0.1.0
         *
         * @return list<SupportedOption> The supported options.
         */
        public function getSupportedOptions(): array
        {
            return $this->supportedOptions;
        }
        /**
         * {@inheritDoc}
         *
         * @since 0.1.0
         */
        public static function getJsonSchema(): array
        {
            return ['type' => 'object', 'properties' => [self::KEY_ID => ['type' => 'string', 'description' => 'The model\'s unique identifier.'], self::KEY_NAME => ['type' => 'string', 'description' => 'The model\'s display name.'], self::KEY_SUPPORTED_CAPABILITIES => ['type' => 'array', 'items' => ['type' => 'string', 'enum' => CapabilityEnum::getValues()], 'description' => 'The model\'s supported capabilities.'], self::KEY_SUPPORTED_OPTIONS => ['type' => 'array', 'items' => \WordPress\AiClient\Providers\Models\DTO\SupportedOption::getJsonSchema(), 'description' => 'The model\'s supported configuration options.']], 'required' => [self::KEY_ID, self::KEY_NAME, self::KEY_SUPPORTED_CAPABILITIES, self::KEY_SUPPORTED_OPTIONS]];
        }
        /**
         * {@inheritDoc}
         *
         * @since 0.1.0
         *
         * @return ModelMetadataArrayShape
         */
        public function toArray(): array
        {
            return [self::KEY_ID => $this->id, self::KEY_NAME => $this->name, self::KEY_SUPPORTED_CAPABILITIES => array_map(static fn(CapabilityEnum $capability): string => $capability->value, $this->supportedCapabilities), self::KEY_SUPPORTED_OPTIONS => array_map(static fn(\WordPress\AiClient\Providers\Models\DTO\SupportedOption $option): array => $option->toArray(), $this->supportedOptions)];
        }
        /**
         * {@inheritDoc}
         *
         * @since 0.1.0
         */
        public static function fromArray(array $array): self
        {
            static::validateFromArrayData($array, [self::KEY_ID, self::KEY_NAME, self::KEY_SUPPORTED_CAPABILITIES, self::KEY_SUPPORTED_OPTIONS]);
            return new self($array[self::KEY_ID], $array[self::KEY_NAME], array_map(static fn(string $capability): CapabilityEnum => CapabilityEnum::from($capability), $array[self::KEY_SUPPORTED_CAPABILITIES]), array_map(static fn(array $optionData): \WordPress\AiClient\Providers\Models\DTO\SupportedOption => \WordPress\AiClient\Providers\Models\DTO\SupportedOption::fromArray($optionData), $array[self::KEY_SUPPORTED_OPTIONS]));
        }
        /**
         * Performs a deep clone of the model metadata.
         *
         * This method ensures that supported option objects are cloned to prevent
         * modifications to the cloned metadata from affecting the original.
         *
         * @since 0.4.2
         */
        public function __clone()
        {
            $clonedOptions = [];
            foreach ($this->supportedOptions as $option) {
                $clonedOptions[] = clone $option;
            }
            $this->supportedOptions = $clonedOptions;
        }
    }
    ```

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

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

| Version | Description | 
| [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-models-dto-modelmetadata%2F)
before being able to contribute a note or feedback.