# AI providers

Herald uses one model to score candidates and another to write the entries. Any of them can be
an API key, a local model, your Claude or ChatGPT subscription, or nothing at all.

Set `HERALD_AI_PROVIDER` in `.env`. It applies to both stages in `config.example.json`. Models come
from `HERALD_SCORING_MODEL` and `HERALD_ENRICH_MODEL`; leave them empty to use the provider
default. If a provider block has no `api_key`, Herald reads the provider's environment variable.

| `HERALD_AI_PROVIDER` | Auth | Default models (scoring / writing) | Notes |
|---|---|---|---|
| `anthropic` | `ANTHROPIC_API_KEY` | `claude-haiku-5-5` / `claude-opus-5-5` | System prompt cached across batches; `effort` sets reasoning depth |
| `openai` | `OPENAI_API_KEY` | set explicitly | Chat Completions; `base_url` for any compatible server |
| `openrouter` | `OPENROUTER_API_KEY` | set explicitly (from the OpenRouter catalog) | One key, many vendors |
| `opencode` | `OPENCODE_API_KEY` | set explicitly (from the Go plan model list) | OpenCode Go subscription; set `base_url` to `https://opencode.ai/zen/v1` for Zen |
| `gemini` | `GEMINI_API_KEY` | set explicitly | `google-genai` |
| `ollama` | none | set explicitly | Local models (`http://localhost:11434/v1`) |
| `claude-code` | your `claude` login | `haiku` / `opus` | Uses your Claude subscription through the installed CLI |
| `codex` | your `codex` login | account default | Uses your ChatGPT subscription through the installed CLI |
| `none` | | | No LLM: the stories are ranked by the pre-filter and keep their feed headline and lede, untranslated and cut at a word, in every briefing language. Free, for a first look or a test |

Scoring and writing can use different providers: edit `ai.scoring` and `ai.enrichment` in
`config.json`.

## Using a Claude or ChatGPT subscription (`claude-code`, `codex`)

Herald runs the unmodified CLI you installed and signed in to, as a subprocess, and reads its
JSON output. It never reads or stores the CLI's credentials.

- Each call starts in an empty temporary directory with every tool disabled: no shell, files,
  web, MCP servers, plugins or hooks. Text from a feed cannot make the agent do anything.
- Usage counts against your plan's limits. The cost report shows `$0.0000`.
- `claude-code` removes `ANTHROPIC_*` variables from the child process, so the subscription is
  used even if `.env` also has an API key.
- Herald must run **on the machine where the CLI is signed in**, so GitHub Actions won't work
  with these providers. They also don't work inside the Docker image, which has no signed-in
  CLI: run Herald on the host (cron) with these providers.
- **Unattended runs:** a browser sign-in expires after a while. For a daily job, run
  `claude setup-token` once in a terminal, keep the token in a file only you can read, export it
  as `CLAUDE_CODE_OAUTH_TOKEN` in the cron script, and set `"use_oauth_token_env": true` in both
  `ai.scoring` and `ai.enrichment`. Herald then lets the CLI read that variable; it never reads
  or stores the value itself. Without the flag the variable is removed like the others.
- This is for personal use. Anthropic's terms reserve subscription logins for individual use,
  so a briefing you send to other people should use an API key.
