# Model policy

Which models a workspace may use, by provider, with each provider's data terms and the defaults per task kept in step.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Model policy. Three providers with their data terms. Switch off Claude Opus 5.5 and the Code default asks for another. Preview: https://chatcn.dev/preview/model-policy-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/model-policy
```

## Usage

```tsx
import { ModelPolicy } from "@/components/ui/chatcn/pro/model-policy"

<ModelPolicy
  models={models}       // ModelOption[] from model-picker
  providers={[{ id: "anthropic", name: "Anthropic", region: "US and EU", retention: "Zero data retention" }, …]}
  allowed={allowed}
  onAllowedChange={setAllowed}
  newModels="review"
  onNewModelsChange={setRule}
  defaults={{ tasks, value: defaults, onValueChange: setDefaults }}
/>
```

Models are grouped by provider, and each provider states where it processes requests and what it keeps, as plain facts beside its name, because that is the first thing a security review asks. Each model has a switch and each provider an allow all with a count when only some are on. A rule says whether new models from allowed providers arrive allowed or wait for review. With `defaults`, the default model per task sits underneath as `default-models`; every model row says which tasks it is the default for, and blocking one of those makes the task ask for another. Without handlers it is read only, so members can see the policy too.

## Examples

### States

Example: States. Read only for members, in a narrow frame. Preview: https://chatcn.dev/preview/model-policy-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `models` | `ModelOption[]` | From the free `model-picker` |
| `providers` | `PolicyProvider[]` | `{ id, name, icon?, region?, retention? }` |
| `allowed`, `onAllowedChange` | `string[]` | Model ids the workspace may use |
| `newModels`, `onNewModelsChange` | `"allow" | "review"` | What happens to new models |
| `defaults` | `DefaultModelsProps` without models | Shows default models per task underneath |
| `labels` | `Partial<ModelPolicyLabels>` | Every string, for translation |

## Accessibility

- Every switch is named: Allow Claude Opus 5.5, Allow every Anthropic model.
- The new model rule is a native radio group.
- A blocked default is a status message on its task.

## Motion

Switch thumbs slide 150 ms. Nothing else moves.

Source: https://chatcn.dev/docs/components/model-policy