# `check-ai`
Validates a block against a rule stated in plain English, using an LLM. For rules that regex cannot
express — "must mention the company name", "no TODOs left", "the tone matches the rest of the page".
## Syntax
| `check-ai` | the condition, in natural language | — |
| `check-ai-pattern` | regex; the `(?P<value>…)` group, or the whole match | whole block |
## Example
```html
<p>Welcome to Acme Corp!</p>
```
## Targeted checks
`check-ai-pattern` sends only the matching parts of the block to the model, which keeps the prompt
focused and the token cost down:
```python
prices = [
# <block check-ai="Prices must be under $100" check-ai-pattern="\$(?P<value>\d+)">
"Item A: $50",
"Item B: $150", # Violation
# </block>
]
```
## Configuration
[//]: # (<block name="check-ai-env-vars" same-as-pattern="BLOCKWATCH_AI_[A-Z_]+">)
- `BLOCKWATCH_AI_API_KEY`: API Key.
- `BLOCKWATCH_AI_MODEL`: Model name (default: `gpt-5-nano`).
- `BLOCKWATCH_AI_API_URL`: Custom OpenAI compatible API URL (optional).
[//]: # (</block>)
Any OpenAI-compatible endpoint works.
## Notes
- **This is the expensive validator.** It makes a network call per block and needs an API key. Reach
for a deterministic validator first — see [choosing a validator](README.md#which-validator-do-i-want).
- Blocks are checked concurrently, so a run with many `check-ai` blocks costs roughly one round trip
rather than N.
- Disable it for local runs with `blockwatch -d check-ai` when you do not want to spend tokens. See
the [CLI reference](../cli.md).
- An empty condition is a hard error.
---
← [Validators](README.md) · [README](../../README.md)