# Class LittleGhost::ModelResolver

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/ModelResolver.html

Maps an application model role to an executable Model.

    resolver = LittleGhost::ModelResolver.new(
      profiles: {
        customer_support: {target: "openrouter:openai/gpt-5.6-luna"}
      }
    )
    # With OPENROUTER_API_KEY set:
    model = resolver.resolve(:customer_support)

A role is an application-facing name such as `:customer_support`.
Callers may also pass a `provider:model-id` target or an inline
configuration mapping.

## Inheritance

`LittleGhost::ModelResolver < Object`

## Attributes

<a id="attribute-i-catalog"></a>
### `catalog` (R)

Provider configuration and model metadata catalog.

<a id="attribute-i-default_model"></a>
### `default_model` (R)

Logical role used when an agent does not declare one.

<a id="attribute-i-providers"></a>
### `providers` (R)

Provider configuration and model metadata catalog.

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new(providers: nil, profiles: nil, default_model: nil, provider_registry: ProviderRegistry.new,
      catalog: nil, catalog_sources: [], provider_adapters: {}, credential_resolver: nil)
```

Builds a resolver from explicit provider connections and profiles. With
neither, conventional credentials select GPT-5.6 Luna.

## Instance methods

<a id="method-i-details"></a>
### `#details`

```ruby
#details(target)
```

Returns normalized metadata for `target` without constructing a provider.

<a id="method-i-refresh-21"></a>
### `#refresh!`

```ruby
#refresh!(target: nil)
```

Refreshes configured metadata sources, retaining stale data on failure.

<a id="method-i-resolve"></a>
### `#resolve`

```ruby
#resolve(selection, invocation: nil, context: nil, profiles: nil, **options)
```

Resolves a logical role, canonical target, or inline model mapping into an
executable Model. Inline mappings require `provider` and `model`; remaining
entries are trusted model settings. The optional `profiles` mapping applies
only to role selections and is never read from `invocation`.
