> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/ai-in-umbraco/19.latest/reference/models/ai-model-ref.md).

# AIModelRef

Reference to a specific AI model.

A lightweight struct that references a specific AI model from a provider.

## Namespace

```csharp
using Umbraco.AI.Core.Models;
```

## Definition

{% code title="AIModelRef" %}

```csharp
public readonly struct AIModelRef
{
    public AIModelRef(string providerId, string modelId);

    public string ProviderId { get; }
    public string ModelId { get; }

    public override string ToString() => $"{ProviderId}/{ModelId}";
}
```

{% endcode %}

## Properties

| Property     | Type     | Description                      |
| ------------ | -------- | -------------------------------- |
| `ProviderId` | `string` | The provider's unique identifier |
| `ModelId`    | `string` | The model's unique identifier    |

## Constructor

```csharp
public AIModelRef(string providerId, string modelId)
```

| Parameter    | Type     | Description                      |
| ------------ | -------- | -------------------------------- |
| `providerId` | `string` | Provider ID (required, non-null) |
| `modelId`    | `string` | Model ID (required, non-null)    |

**Throws**: `ArgumentNullException` if either parameter is null.

## Usage

### Creating a Model Reference

{% code title="Example" %}

```csharp
// OpenAI GPT-4o
var gpt4o = new AIModelRef("openai", "gpt-4o");

// OpenAI GPT-4o mini
var gpt4oMini = new AIModelRef("openai", "gpt-4o-mini");

// OpenAI embedding model
var embedding = new AIModelRef("openai", "text-embedding-3-small");
```

{% endcode %}

### Using with Profiles

{% code title="Example" %}

```csharp
var profile = new AIProfile
{
    Alias = "my-assistant",
    Name = "My Assistant",
    Capability = AICapability.Chat,
    Model = new AIModelRef("openai", "gpt-4o"),
    ConnectionId = connectionId
};
```

{% endcode %}

### String Representation

{% code title="Example" %}

```csharp
var model = new AIModelRef("openai", "gpt-4o");
Console.WriteLine(model.ToString()); // Output: "openai/gpt-4o"
Console.WriteLine($"Using model: {model}"); // Output: "Using model: openai/gpt-4o"
```

{% endcode %}

## Common Model IDs

### OpenAI Chat Models

| Model ID        | Description                   |
| --------------- | ----------------------------- |
| `gpt-4o`        | GPT-4o (Omni)                 |
| `gpt-4o-mini`   | GPT-4o Mini (faster, cheaper) |
| `gpt-4-turbo`   | GPT-4 Turbo                   |
| `gpt-3.5-turbo` | GPT-3.5 Turbo                 |

### OpenAI Embedding Models

| Model ID                 | Description                       |
| ------------------------ | --------------------------------- |
| `text-embedding-3-small` | Small embedding model (1536 dims) |
| `text-embedding-3-large` | Large embedding model (3072 dims) |
| `text-embedding-ada-002` | Ada v2 (legacy)                   |

## Notes

* `AIModelRef` is a `readonly struct` for performance
* Both properties are required and validated in the constructor
* The `ToString()` method provides a canonical string format


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/ai-in-umbraco/19.latest/reference/models/ai-model-ref.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
