---
title: "ADR-007: Multi-Provider Strategy"
manual: "TYPO3 LLM Extension"
version: "main"
permalink: "https://docs.typo3.org/permalink/netresearch/nr-llm:adr-007@main"
source: "Adr/Adr007MultiProviderStrategy.rst"
rendered: "2026-09-24T12:49:43+00:00"
---

# ADR-007: Multi-Provider Strategy {#adr-007}

-   *Status:* Accepted
-   *Date:* 2024-01
-   *Authors:* Netresearch DTT GmbH

## Context {#adr-007-context}

Supporting multiple providers requires:

-   Dynamic provider registration.
-   Priority-based selection.
-   Configuration per provider.
-   Fallback mechanisms.

## Decision {#adr-007-decision}

Use **tagged service collection** with priority:

**Configuration/Services.yaml**

```yaml
# Services.yaml
Netresearch\NrLlm\Provider\OpenAiProvider:
  tags:
    - name: nr_llm.provider
      priority: 100

Netresearch\NrLlm\Provider\ClaudeProvider:
  tags:
    - name: nr_llm.provider
      priority: 90
```

> [!NOTE]
> The shipped providers no longer carry an explicit `tags:` entry — they
> self-register via the `#[AsLlmProvider]` attribute collected by
> `ProviderCompilerPass` ([ADR-022](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-022@main)). The `tags:` form
> above still works for third-party providers.

Provider selection:

1.  Explicit provider in the per-call options.
1.  Otherwise the active DB-backed default configuration's provider.
1.  Otherwise `getProvider(null)` **throws** a `ProviderException`.

There is deliberately **no** "first provider by priority" fallback: the
implicit default-provider fallback was removed in [ADR-034](https://docs.typo3.org/permalink/netresearch/nr-llm:adr-034@main), so
provider selection is always explicit (per-call option or the active
configuration).

## Consequences {#adr-007-consequences}

**Positive:**

-   ● Easy provider registration.
-   ● Clear priority system.
-   ●● Supports custom providers.
-   ● Automatic fallback.

**Negative:**

-   ◑ Priority conflicts possible.
-   ◑ All providers instantiated.
-   ◑ Configuration complexity.

**Net Score:** +5.5 (Strong positive impact - flexible
multi-provider support with minor overhead)
