# Providers

A provider is a NuGet package that enables Umbraco.AI to communicate with a specific AI service. Providers handle the details of API authentication, request formatting, and response parsing.

## How Providers Work

Providers are discovered automatically when you install their NuGet package. They register themselves using the `[AIProvider]` attribute and implement the `IAIProvider` interface.

```
┌─────────────────────────────────────────────────────────────────────────────────┐
│                                 Umbraco.AI                                      │
│    ┌─────────────────────────────────────────────────────────────────────────┐  │
│    │                          Provider Registry                              │  │
│    │  ┌──────────┐ ┌───────────┐ ┌──────────┐ ┌─────────┐ ┌───────────────┐  │  │
│    │  │  OpenAI  │ │ Anthropic │ │ Google   │ │ Amazon  │ │ MS AI Foundry │  │  │
│    │  │ Provider │ │  Provider │ │ Provider │ │ Bedrock │ │   Provider    │  │  │
│    │  └──────────┘ └───────────┘ └──────────┘ └─────────┘ └───────────────┘  │  │
│    └─────────────────────────────────────────────────────────────────────────┘  │
└─────────────────────────────────────────────────────────────────────────────────┘
```

## Available Providers

| Provider             | Package                       | Capabilities                    |
| -------------------- | ----------------------------- | ------------------------------- |
| OpenAI               | `Umbraco.AI.OpenAI`           | Chat, Embedding, Speech-to-Text |
| Anthropic            | `Umbraco.AI.Anthropic`        | Chat                            |
| Google Gemini        | `Umbraco.AI.Google`           | Chat                            |
| Amazon Bedrock       | `Umbraco.AI.Amazon`           | Chat, Embedding                 |
| Microsoft AI Foundry | `Umbraco.AI.MicrosoftFoundry` | Chat, Embedding                 |

{% hint style="info" %}
For detailed configuration instructions for each provider, see the [Providers](/ai-in-umbraco/providers/providers.md) section. You can also create custom providers.
{% endhint %}

## Provider Discovery

Providers are discovered at application startup through assembly scanning. Any class with the `[AIProvider]` attribute that implements `IAIProvider` is automatically registered.

{% code title="OpenAIProvider.cs" %}

```csharp
[AIProvider("openai", "OpenAI")]
public class OpenAIProvider : AIProviderBase<OpenAIProviderSettings>
{
    public OpenAIProvider(IAIProviderInfrastructure infrastructure)
        : base(infrastructure)
    {
        WithCapability<OpenAIChatCapability>();
        WithCapability<OpenAIEmbeddingCapability>();
    }
}
```

{% endcode %}

## Provider Settings

Each provider defines its own settings class. Common settings include:

| Setting      | Description                             |
| ------------ | --------------------------------------- |
| API Key      | Authentication credential               |
| Endpoint     | API URL (for custom endpoints)          |
| Organization | Organization identifier (if applicable) |

Settings are defined using the `[AIField]` attribute:

{% code title="OpenAIProviderSettings.cs" %}

```csharp
using System.ComponentModel.DataAnnotations;

public class OpenAIProviderSettings
{
    [AIField(IsSensitive = true)]
    [Required]
    public string? ApiKey { get; set; }

    [AIField]
    public string? OrganizationId { get; set; }
}
```

{% endcode %}

## Provider Capabilities

A provider can support multiple capabilities:

* **Chat** - Conversational AI and text generation
* **Embedding** - Vector embeddings for semantic search
* **Speech-to-Text** - Audio transcription and voice input

Each capability is implemented as a separate class and registered in the provider constructor.

## Accessing Providers in Code

You rarely need to interact with providers directly. The service layer handles provider resolution based on the profile's connection.

If you need to access provider information:

{% code title="Example.cs" %}

```csharp
public class ProviderInfo
{
    private readonly IAIRegistry _registry;

    public ProviderInfo(IAIRegistry registry)
    {
        _registry = registry;
    }

    public IEnumerable<string> GetAvailableProviders()
    {
        return _registry.GetProviders().Select(p => p.Name);
    }
}
```

{% endcode %}

## Creating Custom Providers

You can create providers for AI services not yet supported. See:

{% content-ref url="/pages/Z3IUyFRjEAuyBVPTkAL6" %}
[Custom Providers](/ai-in-umbraco/extending/providers.md)
{% endcontent-ref %}

## Related

* [Connections](/ai-in-umbraco/concepts/connections.md) - Store credentials for a provider
* [Capabilities](/ai-in-umbraco/concepts/capabilities.md) - The operations a provider supports


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbraco.com/ai-in-umbraco/concepts/providers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
