Home/Docs/BYO LLM setup

Bring your own LLM

Deterministic packs never need an LLM. For the long tail, mendapi review --llm (confidence re-check) and mendapi llmfix (draft patches) can use your LLM — your key, your endpoint, your compute. mendapi never proxies your credentials or your code through our infrastructure.

Configuration

Four environment variables control everything:

shell
MENDAPI_LLM_PROVIDER   openai | anthropic | openai-compatible
MENDAPI_LLM_API_KEY    provider API key (optional for openai-compatible)
MENDAPI_LLM_BASE_URL   required for openai-compatible (e.g. http://localhost:11434/v1)
MENDAPI_LLM_MODEL      model name (required)

Examples

shell
# OpenAI
export MENDAPI_LLM_PROVIDER=openai
export MENDAPI_LLM_API_KEY=sk-...
export MENDAPI_LLM_MODEL=gpt-4o

# Anthropic
export MENDAPI_LLM_PROVIDER=anthropic
export MENDAPI_LLM_API_KEY=sk-ant-...
export MENDAPI_LLM_MODEL=claude-sonnet-4-20250514

# Local / self-hosted (vLLM, Ollama, LM Studio, enterprise gateway)
export MENDAPI_LLM_PROVIDER=openai-compatible
export MENDAPI_LLM_BASE_URL=http://localhost:11434/v1
export MENDAPI_LLM_MODEL=llama3.1:70b

Safety properties

  • Nothing LLM-related runs unless you pass --llm (review) or invoke llmfix with a configured provider. Without config, commands fail loud with setup instructions instead of silently degrading.
  • llmfix emits draft patches only — it never writes to your repo. Drafts that fail parsing, are identical to the original, or fail a syntax check are discarded, never guessed.
  • Exactly one module in the codebase can send LLM traffic, and it is only loaded on the opt-in path. A security review of mendapi's LLM egress is one file long.
Pre-release documentation, generated from the mendapi codebase. Command output and pack listings reflect the shipped CLI exactly.