---
title: "Check which OneContact model package is active in C#"
url: https://recursiveai.org/onecontact/cookbook/choose-active-address-model-package/
description: "Print ContactModels.PackageId at runtime and see why the Tier 1 + Tier 2 model wins when both OneContact model packages are referenced."
version: "1.1.0"
---

# Check the active OneContact model in C#

**OneContact** is a free, open-source contact data library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies, no network access.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneContact.Models) · [GitHub](https://github.com/recursive-ai-oss/onecontact-csharp) · [Docs](https://recursiveai.org/onecontact/docs/) · [Download example (.zip)](https://recursiveai.org/onecontact/cookbook/choose-active-address-model-package/choose-active-address-model-package.zip)

`ContactModels.PackageId` tells you which package supplies the default address and name models.

OneContact uses built-in rules first to classify names; `RecursiveAI.OneContact.Models.Tier1` bundles a small offline model for the United States and Canada, and `RecursiveAI.OneContact.Models` also covers Mexico, Australia, the United Kingdom, the Crown dependencies, and the Latin-script countries of Europe.

```shell
dotnet add package RecursiveAI.OneContact.Models.Tier1
dotnet add package RecursiveAI.OneContact.Models
```

This demo installs both packages only to show which one wins; in your app, reference just one.

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneContact.Models;

Console.WriteLine(
    ContactModels.PackageId ?? "No model");
```

Paste the code above into Program.cs of a new `dotnet new console` project and `dotnet run`, or unzip [the example](https://recursiveai.org/onecontact/cookbook/choose-active-address-model-package/choose-active-address-model-package.zip) and `dotnet run`.

With both packages, prints:

```text
RecursiveAI.OneContact.Models
```

If it prints `No model`, no default model package is active at the point where the code runs.

## Variations

### Check Tier 1 by itself

In a copy of the example project, remove the Tier 1 + Tier 2 package and rerun the same program:

```shell
dotnet remove package RecursiveAI.OneContact.Models
dotnet run
```

```text
RecursiveAI.OneContact.Models.Tier1
```

## Related recipes

- [Parse contacts with rules only](https://recursiveai.org/onecontact/cookbook/parse-contacts-with-rule-only-model-scope/)
- [Tell a person from a company by name](https://recursiveai.org/onecontact/cookbook/classify-ambiguous-person-or-company-name/)

## The short answer

Read `ContactModels.PackageId` from the running application. With both published model packages referenced, it returns `RecursiveAI.OneContact.Models`. With only the Tier 1 model package, it returns `RecursiveAI.OneContact.Models.Tier1`. With just the core package and no custom configuration, it returns `null`. The property reports a registration; it doesn’t have to load the trained weights to tell you which package won.

## Which OneContact model wins when both NuGet packages are installed?

Tier 1 registers its address and name models at rank 1; the Tier 1 + Tier 2 package registers them at rank 2. The registry keeps the higher rank, regardless of the order in which the packages register. In a normal C# project, each package contributes a module initializer that registers it automatically. There’s no need to call `Register()` to choose between the two.

Choose Tier 1 if you only need model support for US and Canadian inputs: it has about 10 MB of model weights. The [Tier 1 + Tier 2 package](https://recursiveai.org/onecontact/docs/models-superset/) handles US and Canadian inputs the same way and adds model support for Tier 2 inputs, with about 23 MB of weights. With Tier 1 alone, Tier 2 inputs still get the built-in rules but no model fallback.

## How do I check which NuGet packages a .NET project references?

Run [.NET’s package list command](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-package-list) from the project directory:

```shell
dotnet package list --include-transitive
```

The example lists both model packages as top-level dependencies. The core `RecursiveAI.OneContact` package is transitive: it’s brought in by the model packages. That list tells you what NuGet resolved; the C# output tells you which registration won. The namespace `RecursiveAI.OneContact.Models` also exists in the core package, so the fact that the `using` statement compiles does not prove a model was registered.

If you use `ContactModels.Use` to override the models for a scope, `PackageId` reports `scoped` inside it instead of a NuGet ID. And even outside such a scope, the package ID says what’s available to the parsers by default, not whether a particular field came from a model. For a field-level answer, look at that field’s `ParseDetail`; [the model docs](https://recursiveai.org/onecontact/docs/models/) describe how it marks rule and model decisions.
