# LLM providers for the Python fallback engine

> Configure the optional LLM fallback in the Python quelltest package: providers, how to store a key, how to enable it, and exactly what the prompt contains.

Canonical page: https://quelltest.com/docs/configuration/llm-providers

The Python package never needs an LLM for its core job: the rule engine reads guard clauses and writes tests offline. An LLM is an opt-in fallback for requirements the rule engine cannot handle, and for `quell reproduce`. This page covers the supported providers, how to enable them, and what is sent. The npm package has no built-in LLM: its `--llm` option runs a module you write, see [npm privacy](https://quelltest.com/docs/npm/privacy.md).

## Do I need an LLM?

No. With no key configured, `quell find` makes zero network calls. Gaps the rule engine cannot handle are scaffolded or flagged instead of being sent anywhere.

## Which providers are supported?

`groq`, `anthropic`, `openai` and `ollama`. Pick one with `llm_provider` (and `llm_model`) in `[tool.quell]`; see [pyproject.toml](https://quelltest.com/docs/configuration/pyproject.md).

```toml
[tool.quell]
llm_provider = "groq"
llm_model = "llama-3.3-70b-versatile"
```

## How do I add a key?

```bash
pip install "quelltest[groq]"
quell auth set --provider groq --key sk-...
```

Groq also reads the `GROQ_API_KEY` environment variable. `quell auth set` stores the key in the OS keyring when the `keyring` extra is installed, otherwise in `auth.json` in your user config folder; see [`quell auth`](https://quelltest.com/docs/cli/auth.md). `ollama` uses the endpoint in `ollama_base_url` (default `http://localhost:11434`) and needs no key.

## How do I turn it on?

Pass `--use-llm` on the command line:

```bash
quell find src/ --fix --use-llm
```

The `use_llm` key exists in the configuration model but is not read by `quell find` in the version tested; the flag is what enables the fallback.

## What is sent to the provider?

For rule-engine gaps handed to the LLM, the prompt is built from the requirement, not from the whole file. It contains:

1. the requirement description and its constraint kind,
2. the target function name and the source file name (not the path),
3. the spec text (for example the guard clause `if amount <= 0:`),
4. a violation input and expected behaviour, when known,
5. instructions for writing a pytest test.

`quell reproduce` sends the bug description to be parsed, and the docstring reader can send docstring prose to the LLM when it cannot parse it with its structured parsers (Google, NumPy, RST). Full source files, test bodies, secrets and environment variables are not part of these prompts. `quell auth status --privacy` prints the same summary.

## How do I guarantee nothing leaves my machine?

Do not pass `--use-llm` and do not configure a key. In that mode every command is local AST scanning plus pytest subprocesses.
