Providers
The review pass runs against one LLM provider, resolved from flags and the environment. Flags always win over env. Nothing here is persisted — see Credentials.
Choosing a provider
Section titled “Choosing a provider”--provider accepts anthropic, openai, or auto (the default).
With auto, miu-cr picks OpenAI when OPENAI_API_KEY is set (or --provider openai is passed) and no Anthropic credential is present; otherwise it picks Anthropic. An Anthropic credential means any of --api-key, --auth-token, ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or ZAI_API_KEY. Anthropic is the default because it backs both the native API and Anthropic-compatible gateways.
Anthropic
Section titled “Anthropic”export ANTHROPIC_API_KEY=...miucr review --stagedResolution order (first non-empty wins):
| Setting | Flag | Env | Default |
|---|---|---|---|
| API key | --api-key | ANTHROPIC_API_KEY | — (required unless an auth token is set) |
| Auth token | --auth-token | ANTHROPIC_AUTH_TOKEN | — |
| Base URL | --base-url | ANTHROPIC_BASE_URL | SDK default |
| Model | --model | ANTHROPIC_MODEL | claude-sonnet-4-5-20250929 |
The API key is sent as the x-api-key header. When you supply an auth token instead, it is sent as a Bearer Authorization header — this is what Anthropic-compatible gateways like z.ai expect.
GLM via z.ai (Anthropic-compatible)
Section titled “GLM via z.ai (Anthropic-compatible)”z.ai exposes an Anthropic-compatible gateway, so miu-cr drives GLM through the Anthropic path with a base URL + bearer token. Two equivalent ways:
Explicit base URL + auth token:
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropicexport ANTHROPIC_AUTH_TOKEN=$ZAI_API_KEYmiucr review --staged --model glm-4.6Shorthand with ZAI_API_KEY:
export ZAI_API_KEY=...miucr review --staged --model glm-4.6With ZAI_API_KEY set and no other Anthropic credential, miu-cr uses it as the bearer auth token and defaults the base URL to https://api.z.ai/api/anthropic. Either form also works as flags:
miucr review --staged \ --base-url https://api.z.ai/api/anthropic \ --auth-token "$ZAI_API_KEY" \ --model glm-4.6OpenAI (and OpenAI-compatible)
Section titled “OpenAI (and OpenAI-compatible)”export OPENAI_API_KEY=...miucr review --staged --provider openaiResolution order:
| Setting | Flag | Env | Default |
|---|---|---|---|
| API key | --api-key | OPENAI_API_KEY | — (required) |
| Base URL | --base-url | OPENAI_BASE_URL | https://api.openai.com/v1 |
| Model | --model | OPENAI_MODEL | gpt-4o |
Point --base-url / OPENAI_BASE_URL at any OpenAI-compatible endpoint to use a different gateway.
Missing credentials
Section titled “Missing credentials”If no credential is found for the resolved provider, the review fails with a typed error (exit 1) and a hint, e.g.:
no Anthropic credentials: set ANTHROPIC_API_KEY (or ANTHROPIC_AUTH_TOKEN / ZAI_API_KEY) or pass --api-key / --auth-token