Skip to content

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.

--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.

Terminal window
export ANTHROPIC_API_KEY=...
miucr review --staged

Resolution order (first non-empty wins):

SettingFlagEnvDefault
API key--api-keyANTHROPIC_API_KEY— (required unless an auth token is set)
Auth token--auth-tokenANTHROPIC_AUTH_TOKEN
Base URL--base-urlANTHROPIC_BASE_URLSDK default
Model--modelANTHROPIC_MODELclaude-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.

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:

Terminal window
export ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
export ANTHROPIC_AUTH_TOKEN=$ZAI_API_KEY
miucr review --staged --model glm-4.6

Shorthand with ZAI_API_KEY:

Terminal window
export ZAI_API_KEY=...
miucr review --staged --model glm-4.6

With 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:

Terminal window
miucr review --staged \
--base-url https://api.z.ai/api/anthropic \
--auth-token "$ZAI_API_KEY" \
--model glm-4.6
Terminal window
export OPENAI_API_KEY=...
miucr review --staged --provider openai

Resolution order:

SettingFlagEnvDefault
API key--api-keyOPENAI_API_KEY— (required)
Base URL--base-urlOPENAI_BASE_URLhttps://api.openai.com/v1
Model--modelOPENAI_MODELgpt-4o

Point --base-url / OPENAI_BASE_URL at any OpenAI-compatible endpoint to use a different gateway.

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