Skip to content

Configure the model gate

The [model] block of the mandate turns the model gate on and chooses its backend:

Setting Default Meaning
enabled false Turns the model gate on.
backend "anthropic" anthropic calls the Claude API. openai calls any OpenAI-compatible server, such as oMLX or Ollama.
model "claude-haiku-5-5" The model ID, as the backend names it.
effort "low" Effort level. anthropic only.
endpoint "http://localhost:8080/v1" Base URL of the server. openai only.
api_key_env "SYNTH_API_KEY" Environment variable whose value is sent as a bearer token. openai only. When the variable is unset or empty, no key is sent.
timeout_seconds 20 How long one model call may take before the gate asks a person.

The backends differ in how they get a reliable answer:

  • anthropic requests structured output with a fixed JSON schema. It needs the model extra and Anthropic credentials in the environment, for example ANTHROPIC_API_KEY or an ant auth login profile.
  • openai uses only the Python standard library. It asks for JSON in the prompt, then reads the outermost JSON object out of the reply, skipping any reasoning or prose around it.

Use the Claude API

[model]
enabled = true
backend = "anthropic"
model = "claude-haiku-5-5"
effort = "low"

Use a local model on oMLX

[model]
enabled = true
backend = "openai"
model = "Qwen3-4B-Instruct-2507-MLX-8bit"
endpoint = "http://localhost:8080/v1"

oMLX requires a key. The gate reads it from SYNTH_API_KEY, the default api_key_env. Set that variable in the environment Claude Code runs the hook from, for example export SYNTH_API_KEY=... in your shell profile. The key never goes in the mandate.

Use a local model on Ollama

Ollama needs no key:

[model]
enabled = true
backend = "openai"
model = "hf.co/unsloth/Qwen3-4B-Instruct-2507-GGUF:Q8_0"
endpoint = "http://localhost:11434/v1"
api_key_env = ""

This configuration has run live: on 2026-10-28 it matched all 15 expected verdicts in the test scenarios on two consecutive runs.

Choose a model

A local model works well as the System 1 judge. On the test scenarios, every model below matched every expected verdict; the local models ran on EGS's Mac (Apple M5 Max):

Model Server Date Expected verdicts Seconds per model call
Qwen3-4B-Instruct-2507-MLX-8bit oMLX 2026-10-27 15 of 15 about 0.5-0.7 (2.0 for the first)
Qwen3-4B-Instruct-2507-GGUF:Q8_0 Ollama 0.40.11 2026-10-28 15 of 15 about 0.4-0.6 (3.0 for the first, while the model loads)
Qwen3.8-27B-4bit oMLX 2026-10-27 15 of 15 about 8-45
claude-haiku-5-5 Claude API 2026-12-01 17 of 17 about 1.0-2.2

The local runs predate the two scenarios added on 2026-12-01.

The 27B model names the law more precisely, but its latency is too high for a check on every call. In one earlier 27B run a single call came back unreadable, and the gate fell back to asking, as designed.

The hook's timeout in Claude Code's settings must exceed timeout_seconds. See Install and deploy.