# Authentication

> How Nosmai license keys work, online verification, offline grace, and what your license includes.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/moderations.txt

Product: Nosmai Moderation
Group: get-started
Source: https://nosmai.com/docs/moderations/authentication/

## License keys

The SDK authenticates with a license key that looks like `NOSMAI-XXXX`. Each key is issued for one app and is bound to:

- your app's package name (Android) or bundle identifier (iOS), and
- the platform (iOS or Android).

A key used from a different app or platform is rejected. Get your key from the Nosmai dashboard and pass it to `init` / `initialize` at startup.

The license key is an app-level identifier, not a server secret. It does not unlock anything on its own: the SDK verifies it with the Nosmai licensing service before any models load.

## How verification works

1. On the first launch, the SDK verifies the key online. The device must have connectivity this one time.
1. After a successful check, the result is cached on the device for 24 hours, so later launches do not need the network.
1. If the device is offline when the cache expires, the SDK keeps working for a further 24 hours of grace (48 hours total) before it must reconnect.

If the key is missing, invalid, or expired, initialization fails and the SDK does not run. Handle the failure return from `init` / `initialize` and do not moderate until it succeeds.

> [!NOTE]
Because the first launch needs connectivity and verification loads the models, always call init off the main thread.

## What your license includes

A license enables a specific set of capabilities. The SDK only runs what your plan includes.

**Moderation types**

| Capability | Method |
| --- | --- |
| Image moderation | `analyzeImage` |
| Video moderation | `analyzeVideo` |
| Text moderation | `moderateText` |
| Live moderation | `startStream` and live frames |

**Detection categories**: `adult` (NSFW) for visual classification.

If a moderation type is not in your plan, that call does nothing and returns a safe or empty result. If a detection category is not in your plan, it is never reported. Contact Nosmai to change what your license includes.

## Going to production

Use your production license key in release builds, and keep test and production keys separate so test traffic does not count against production usage.
