# AI explanations of failed sign-ins

When an SSO sign-in fails, OhAuthCat can explain in a few plain sentences what most likely went wrong and what to change. The explanation is written by Claude Haiku, a model from Anthropic, on top of the deterministic [Connection Doctor](/hosted-portal/connection-doctor/).

## Where you see it

- `GET /v1/sign_ins/{sign_in}/explanation` for any failed sign-in, and in the dashboard's sign-in timeline.
- In the setup portal, on an IT admin's failed test sign-in.

The answer says where the text came from in `source`: `provider` for an AI explanation, or `doctor` when the Doctor's own text is used. With `provider`, `model` names the model that wrote it when the provider reports one.

## What is sent

Only catalogue data leaves OhAuthCat:

- the error code, such as `saml_audience_mismatch`;
- that code's catalogue description and the Doctor's known cause for it;
- the names of the checks that ran;
- the identity provider type (`okta`, `entra`, `google`, `onelogin`, `jumpcloud` or `generic`).

Never an email address, name, SAML assertion, token, IP address, certificate, connection setting or any other value from the sign-in. Anything that is not a known catalogue value is dropped before the request is built.

Anthropic is listed as a sub-processor for this feature in the [sub-processor list](/trust/sub-processors/), with where it processes data.

Explanations are cached per combination of code, provider type and checks, so the same failure is asked about once.

## Limits

Explanations have two spend controls. When either applies, no request is sent to the model and you get the Doctor's text, with `unavailable_reason` saying why:

| `unavailable_reason`                                                    | When                                                                    |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [`explanation_rate_limited`](/errors/explanation_rate_limited/)         | Too many explanations were asked for in your environment in one minute. |
| [`explanation_budget_exhausted`](/errors/explanation_budget_exhausted/) | The monthly cost cap for explanations is reached.                       |

Cached explanations do not count. Both controls fail closed: if they cannot be checked, the Doctor's text is served. The data sent to the model is the same with or without these limits.

## When it is not used

If no AI provider is configured for the deployment, a limit above applies, or the provider fails or takes longer than 15 seconds, you get the Doctor's explanation and steps instead (`unavailable_reason` is null except for the limits). The feature never blocks or changes a sign-in.
