> ## Documentation Index
> Fetch the complete documentation index at: https://docs.healops.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LLM Providers

> Supported LLM APIs and CLIs, environment variables, and how to switch between them.

HealOps is provider-agnostic: bring your own model. Selection is controlled by the `LLM_PROVIDER` environment variable, with per-provider API key and model overrides. Defaults are tracked in [`app/config.py`](https://github.com/healopss/opensre/blob/main/app/config.py) and routing lives in [`app/services/llm_client.py`](https://github.com/healopss/opensre/blob/main/app/services/llm_client.py).

## Quick reference

| Provider           | `LLM_PROVIDER` | Auth                                     | Reasoning model default          | Toolcall model default                        |
| ------------------ | -------------- | ---------------------------------------- | -------------------------------- | --------------------------------------------- |
| Anthropic          | `anthropic`    | `ANTHROPIC_API_KEY`                      | `claude-sonnet-4-6`              | `claude-haiku-4-5-20251001`                   |
| OpenAI             | `openai`       | `OPENAI_API_KEY`                         | `gpt-5.4`                        | `gpt-5.4-mini`                                |
| OpenRouter         | `openrouter`   | `OPENROUTER_API_KEY`                     | `openrouter/auto`                | `openrouter/auto`                             |
| Requesty           | `requesty`     | `REQUESTY_API_KEY`                       | `anthropic/claude-sonnet-4-6`    | `anthropic/claude-sonnet-4-6`                 |
| Google Gemini      | `gemini`       | `GEMINI_API_KEY`                         | `gemini-3.1-pro-preview`         | `gemini-3.1-flash-lite-preview`               |
| NVIDIA NIM         | `nvidia`       | `NVIDIA_API_KEY`                         | `meta/llama-3.1-405b-instruct`   | `meta/llama-3.1-8b-instruct`                  |
| MiniMax            | `minimax`      | `MINIMAX_API_KEY`                        | `MiniMax-M2.7`                   | `MiniMax-M2.7-highspeed`                      |
| Amazon Bedrock     | `bedrock`      | AWS IAM (`AWS_REGION`)                   | `us.anthropic.claude-sonnet-4-6` | `us.anthropic.claude-haiku-4-5-20251001-v1:0` |
| Ollama (local)     | `ollama`       | None (local daemon)                      | `llama3.2`                       | `llama3.2`                                    |
| OpenAI Codex CLI   | `codex`        | `codex login` (CLI)                      | Codex CLI default                | Codex CLI default                             |
| Claude Code CLI    | `claude-code`  | `claude login` (CLI)                     | Claude Code CLI default          | Claude Code CLI default                       |
| GitHub Copilot CLI | `copilot`      | `copilot login` or `gh auth login` (CLI) | Copilot CLI default              | Copilot CLI default                           |

HealOps distinguishes two model slots per provider:

* **Reasoning model** — full-capability model used for diagnosis, claim validation, and multi-step analysis.
* **Toolcall model** — lightweight, lower-cost model used for tool selection and routing.

## Selecting a provider

Set `LLM_PROVIDER` (default: `anthropic`) in your environment or `.env` file:

```bash theme={null}
export LLM_PROVIDER=openai
export OPENAI_API_KEY=sk-...
```

Or run the onboarding wizard, which writes the same values to `.env`:

```bash theme={null}
healops onboard
```

Override the default model for a slot via env vars:

```bash theme={null}
export OPENAI_REASONING_MODEL=gpt-5.4
export OPENAI_TOOLCALL_MODEL=gpt-5.4-mini
```

A shared `LLM_MAX_TOKENS` (default `4096`) controls the response token budget for every provider.

## API providers

### Anthropic

```bash theme={null}
export LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY=sk-ant-...
# Optional overrides:
export ANTHROPIC_REASONING_MODEL=claude-sonnet-4-6
export ANTHROPIC_TOOLCALL_MODEL=claude-haiku-4-5-20251001
```

The default. Uses the Anthropic Python SDK directly. Get an API key at [console.anthropic.com](https://console.anthropic.com/).

### OpenAI

```bash theme={null}
export LLM_PROVIDER=openai
export OPENAI_API_KEY=sk-...
# Optional overrides:
export OPENAI_REASONING_MODEL=gpt-5.4
export OPENAI_TOOLCALL_MODEL=gpt-5.4-mini
```

Uses the OpenAI SDK. Reasoning models (`o1`, `o3`, `o4`, `gpt-5*`) automatically use `max_completion_tokens` instead of `max_tokens`.

### OpenRouter

```bash theme={null}
export LLM_PROVIDER=openrouter
export OPENROUTER_API_KEY=sk-or-...
# Optional override (single value applies to both slots if set):
export OPENROUTER_MODEL=openrouter/auto
# Or per-slot:
export OPENROUTER_REASONING_MODEL=anthropic/claude-sonnet-4-6
export OPENROUTER_TOOLCALL_MODEL=openai/gpt-4o-mini
```

OpenAI-compatible proxy — pick any model on [openrouter.ai/models](https://openrouter.ai/models). Base URL: `https://openrouter.ai/api/v1`.

### Requesty

```bash theme={null}
export LLM_PROVIDER=requesty
export REQUESTY_API_KEY=...
# Optional override (single value applies to both slots if set):
export REQUESTY_MODEL=anthropic/claude-sonnet-4-6
# Or per-slot:
export REQUESTY_REASONING_MODEL=anthropic/claude-sonnet-4-6
export REQUESTY_TOOLCALL_MODEL=anthropic/claude-sonnet-4-6
```

OpenAI-compatible gateway at `https://router.requesty.ai/v1`. Sends an `X-Title: HealOps` header for usage attribution. Browse models on [requesty.ai](https://requesty.ai/).

### Google Gemini

```bash theme={null}
export LLM_PROVIDER=gemini
export GEMINI_API_KEY=...
# Optional override:
export GEMINI_MODEL=gemini-3.1-pro-preview
# Or per-slot:
export GEMINI_REASONING_MODEL=gemini-3.1-pro-preview
export GEMINI_TOOLCALL_MODEL=gemini-3.1-flash-lite-preview
```

Uses Google's OpenAI-compatible endpoint at `https://generativelanguage.googleapis.com/v1beta/openai/`. Get an API key at [aistudio.google.com](https://aistudio.google.com/app/apikey).

### NVIDIA NIM

```bash theme={null}
export LLM_PROVIDER=nvidia
export NVIDIA_API_KEY=nvapi-...
# Optional override:
export NVIDIA_MODEL=meta/llama-3.1-405b-instruct
# Or per-slot:
export NVIDIA_REASONING_MODEL=meta/llama-3.1-405b-instruct
export NVIDIA_TOOLCALL_MODEL=meta/llama-3.1-8b-instruct
```

Uses NVIDIA's OpenAI-compatible API at `https://integrate.api.nvidia.com/v1`. Browse available models on [build.nvidia.com](https://build.nvidia.com/).

### MiniMax

```bash theme={null}
export LLM_PROVIDER=minimax
export MINIMAX_API_KEY=...
# Optional override (single value applies to both slots if set):
export MINIMAX_MODEL=MiniMax-M2.7
# Or per-slot:
export MINIMAX_REASONING_MODEL=MiniMax-M2.7
export MINIMAX_TOOLCALL_MODEL=MiniMax-M2.7-highspeed
```

OpenAI-compatible endpoint at `https://api.minimax.io/v1`. Temperature is fixed to `1.0` to match MiniMax recommendations.

### Amazon Bedrock

```bash theme={null}
export LLM_PROVIDER=bedrock
export AWS_REGION=us-east-1
# Optional overrides:
export BEDROCK_REASONING_MODEL=us.anthropic.claude-sonnet-4-6
export BEDROCK_TOOLCALL_MODEL=us.anthropic.claude-haiku-4-5-20251001-v1:0
```

No API key — auth uses the AWS credential chain (environment variables, shared credentials file, or IAM role). Your principal needs permission to invoke the model IDs you configure (for example Bedrock `InvokeModel` / Converse access scoped to those resources in IAM).

**Model routing:**

* **Anthropic Claude** on Bedrock (`anthropic.claude-*`, `us.anthropic.claude-*`, and foundation-model ARNs that contain `anthropic.claude`) use the existing **AnthropicBedrock** SDK path.
* **Other Bedrock foundation models** (for example Mistral, Meta Llama, Amazon Titan IDs you enable in your account) use the **Bedrock Converse** API via `boto3`, so you can set `BEDROCK_REASONING_MODEL` to a non-Claude model ID when your use case requires it.
* **Application inference profile** ARNs (`…:application-inference-profile/…`) do not encode the vendor in the ID; those are always sent through **Converse**, which works for any backing model in the profile.

Defaults in `app/config.py` are US cross-region inference profile IDs for Anthropic Claude; override with IDs or ARNs that are **inference-access enabled** in your account and region.

### Ollama (local)

```bash theme={null}
export LLM_PROVIDER=ollama
# Optional overrides:
export OLLAMA_HOST=http://localhost:11434
export OLLAMA_MODEL=llama3.2
```

Run any local model exposed by an [Ollama](https://ollama.com/) daemon. No API key required — HealOps talks to Ollama's OpenAI-compatible endpoint at `${OLLAMA_HOST}/v1`.

## CLI providers (subprocess)

CLI-backed providers shell out to a vendor CLI instead of an HTTP API. They authenticate via the vendor's own login command; HealOps detects the binary on `PATH` (or via an explicit env var) and reuses the existing session.

### OpenAI Codex

```bash theme={null}
export LLM_PROVIDER=codex
# Authenticate the Codex CLI separately:
codex login
# Optional overrides (all blank-by-default):
export CODEX_MODEL=
export CODEX_BIN=
```

Requires the [OpenAI Codex CLI](https://github.com/openai/codex). If `CODEX_MODEL` is unset, HealOps omits `-m` so `codex exec` uses the CLI's currently configured model. If `CODEX_BIN` is unset, the binary is resolved via `PATH` and known install locations.

### Claude Code

```bash theme={null}
export LLM_PROVIDER=claude-code
# Authenticate the Claude Code CLI separately:
claude login
# Optional overrides (all blank-by-default):
export CLAUDE_CODE_MODEL=
export CLAUDE_CODE_BIN=
```

Requires the [Claude Code CLI](https://github.com/anthropics/claude-code) (`npm i -g @anthropic-ai/claude-code`). If `CLAUDE_CODE_MODEL` is unset, HealOps omits the `--model` flag and the CLI uses its configured default. If `CLAUDE_CODE_BIN` is unset, the binary is resolved via `PATH` and known install locations.

### GitHub Copilot

```bash theme={null}
export LLM_PROVIDER=copilot
# Authenticate the Copilot CLI separately. Either flow works — the adapter
# detects both. The interactive `/login` slash command inside `copilot` writes
# to the platform credential store; `gh auth login` is an equivalent path that
# Copilot CLI delegates to automatically.
copilot login          # OAuth device flow; preferred CLI-first onboarding
# or:
gh auth login          # logs you into the gh CLI; Copilot will use that token
# Optional overrides (all blank-by-default):
export COPILOT_MODEL=
export COPILOT_BIN=
# Optional auth bypass for automation (only used when no CLI login is detected):
# export COPILOT_GITHUB_TOKEN=
# export GH_TOKEN=
# export GITHUB_TOKEN=
```

Requires the [GitHub Copilot CLI](https://docs.github.com/copilot/how-tos/use-copilot-agents/use-copilot-cli) (`npm i -g @github/copilot`). Login uses the interactive `/login` slash command or `copilot login`. HealOps detects auth in this order: (1) `COPILOT_GITHUB_TOKEN` / `GH_TOKEN` / `GITHUB_TOKEN` env, (2) [`gh auth status`](https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/authenticate-copilot-cli#authenticating-with-github-cli) when `gh` is on `PATH` (including `✓ Logged in to github.com account …`, `- Active account: true`, or a supported `- Token:` prefix: `gho_`, `github_pat_`, `ghu_` per Copilot docs — not `ghp_`), with `gh auth status --hostname …` when `COPILOT_GH_HOST` or `GH_HOST` targets a non-`github.com` host. It does **not** read plaintext `$COPILOT_HOME/config.json` (keychain-backed installs may omit it; mis-parsing arbitrary JSON risks false positives). If nothing matches, detection reports `logged_in=None` and the runner verifies at invoke time. If `COPILOT_MODEL` is unset, HealOps omits `--model`. Invocations run as `copilot -p PROMPT --no-color --no-ask-user --silent` so they never block on user input. **BYOK / `COPILOT_OFFLINE`:** GitHub auth may be unnecessary; a `None` probe can still be fine if Copilot is configured for offline or external providers only.

See [`app/integrations/llm_cli/AGENTS.md`](https://github.com/healopss/opensre/blob/main/app/integrations/llm_cli/AGENTS.md) for the adapter pattern used to add new CLI providers.

## Reasoning effort (interactive shell)

In the TTY REPL (`healops` with no subcommand), `/effort` stores a **session** preference for how strongly reasoning models should think before answering. It applies only when `LLM_PROVIDER` is **`openai`** (HTTP API) or **`codex`** (Codex CLI); other providers ignore the setting and the shell notes that.

| Input                            | Sent to the model |
| -------------------------------- | ----------------- |
| `low`, `medium`, `high`, `xhigh` | same string       |
| `max`                            | `xhigh`           |

Run `/effort` alone to show the current choice (or `(default)` when unset) and the usage line. `/reset` clears investigation state but **keeps** `/effort` (and trust mode), consistent with other session prefs.

Outside the REPL, optional defaults use the environment variable:

```bash theme={null}
export HEALOPS_REASONING_EFFORT=high   # low | medium | high | xhigh
```

Session `/effort` overrides this for interactive runs. Implementation: [`app/llm_reasoning_effort.py`](https://github.com/healopss/opensre/blob/main/app/llm_reasoning_effort.py).

## Switching providers at runtime

HealOps caches LLM clients on first use. To switch providers within a single process (tests, benchmarks), call `reset_llm_singletons()` from `app.services.llm_client` after updating the env vars; otherwise a fresh process picks up the new `LLM_PROVIDER` automatically.

## Where this lives in the code

* Provider literals and defaults: [`app/config.py`](https://github.com/healopss/opensre/blob/main/app/config.py) (`LLMProvider`, `LLMSettings`).
* Runtime routing: [`app/services/llm_client.py`](https://github.com/healopss/opensre/blob/main/app/services/llm_client.py) (`_create_llm_client`).
* API-backed provider guide: [`app/services/AGENTS.md`](https://github.com/healopss/opensre/blob/main/app/services/AGENTS.md).
* CLI-backed provider guide: [`app/integrations/llm_cli/AGENTS.md`](https://github.com/healopss/opensre/blob/main/app/integrations/llm_cli/AGENTS.md).
