# HostAIProviders class
{: .no_toc }

The AI models that the IDE's options list, one [**HostAIProvider**](/tB/Packages/tbIDE/HostAIProvider.md) each. Reached through [**HostAI.Providers**](/tB/Packages/tbIDE/HostAI.md#providers).

The collection holds the models whose **Enabled** box is ticked in the **AI** group of [IDE Options](/tB/IDE/Customising/IDE-Options.md#ai-models), in the order of the list. A change to the models restarts the compiler, which loads the add-in again, so the collection an add-in reads does not change while it runs.

```tb check_build
Private Sub ListModels()
    Dim i As Long
    For i = 0 To Host.AI.Providers.Count - 1
        With Host.AI.Providers(i)
            Host.DebugConsole.PrintText i & ": " & .FriendlyName & IIf(.IsDefault, " (default)", "")
        End With
    Next
End Sub
```

* TOC
{:toc}

## Properties

### Count
{: .no_toc }

How many models the collection holds. **Long**, read-only. 0 when the options list no model, or none is enabled.

### DefaultProvider
{: .no_toc }

The model whose **Default** button is selected. **As** [**HostAIProvider**](/tB/Packages/tbIDE/HostAIProvider.md), read-only. Reading it when the collection is empty raises error -2147467259, *Unspecified error*, so test [**Count**](#count) first.

### Item
{: .no_toc }

One model. **As** [**HostAIProvider**](/tB/Packages/tbIDE/HostAIProvider.md), read-only. **Item** is the default member: `Host.AI.Providers(0)` is `Host.AI.Providers.Item(0)`.

Syntax: *providers*.**Item**( *IndexOrName* )

*IndexOrName*
: *required* The model's place in the collection, counted from 0. **Variant**. An index outside the collection raises error -2147467259.

> [!WARNING] BETA 1052
> A **String** for *IndexOrName* returns the first model, whatever the string: its **Friendly Name**, its model's name, or a name that no model has. Find a model by name with a loop that compares [**HostAIProvider.FriendlyName**](/tB/Packages/tbIDE/HostAIProvider.md#friendlyname), as in the example above.

## See Also

- [HostAI.Providers](/tB/Packages/tbIDE/HostAI.md#providers) property
- [HostAIProvider](/tB/Packages/tbIDE/HostAIProvider.md) class
