# How to Configure Wigolo to Use Different LLM Providers (Gemini, Anthropic, OpenAI, Ollama)

> Configure Wigolo to use Gemini, Anthropic, OpenAI, or Ollama for synthesis. Just set the WIGOLO LLM PROVIDER environment variable and your API key. Get started easily.

- Repository: [Towhid Khan/wigolo](https://github.com/KnockOutEZ/wigolo)
- Tags: how-to-guide
- Published: 2026-07-19

---

**Configure Wigolo to synthesize answers using Gemini, Anthropic, OpenAI, or Ollama by setting the `WIGOLO_LLM_PROVIDER` environment variable and the corresponding API key.**

Wigolo is a keyless search and research tool where only the final answer synthesis step requires an LLM. According to the KnockOutEZ/wigolo source code, you can switch between cloud providers and local models using environment variables that are read at runtime in [`src/search/answer-synthesis.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/search/answer-synthesis.ts).

## Core Environment Variables

Wigolo reads a specific set of environment variables to determine which LLM provider to use for synthesis. These are documented in [`docs/configuration.md`](https://github.com/KnockOutEZ/wigolo/blob/main/docs/configuration.md) lines 96-108.

| Variable | Purpose | Example Values |
|----------|---------|----------------|
| `WIGOLO_LLM_PROVIDER` | Selects the provider backend | `gemini`, `anthropic`, `openai`, `groq`, `ollama` |
| `WIGOLO_LLM_MODEL` | Overrides the default model | `gemini-1.5-flash`, `claude-3-5-sonnet`, `gpt-4o`, `llama3:8b` |
| `WIGOLO_LLM_API_KEY` | Generic key slot populated by `wigolo init` | Stored in OS keychain |
| Provider-specific keys | Alternative to generic key slot | `GEMINI_API_KEY`, `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GROQ_API_KEY` |
| `WIGOLO_LLM_BASE_URL` | Endpoint for Ollama or compatible APIs | `http://localhost:11434` |
| `WIGOLO_LLM_CACHE_TTL_DAYS` | Synthesis cache duration | `7` (default) |

When `WIGOLO_LLM_PROVIDER` is unset, Wigolo operates in keyless mode and returns a raw brief with evidence instead of a polished synthesis.

## Provider-Specific Configuration

Each provider requires specific environment variables and offers different default models. The implementation adapters live in `src/integrations/cloud/llm/`.

### Google Gemini

Gemini requires a free API key from Google AI Studio.

- **Required variable**: `GEMINI_API_KEY`
- **Default model**: `gemini-2.5-flash-lite`
- **Implementation**: [`src/integrations/cloud/llm/gemini.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/gemini.ts)

```bash
export WIGOLO_LLM_PROVIDER=gemini
export GEMINI_API_KEY=YOUR_GEMINI_KEY
wigolo search "latest Rust async patterns" --format answer

```

### Anthropic Claude

Anthropic integration uses the Claude API for synthesis.

- **Required variable**: `ANTHROPIC_API_KEY`
- **Default model**: `claude-3-5-sonnet-20240620`
- **Implementation**: [`src/integrations/cloud/llm/anthropic.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/anthropic.ts)

```bash
export WIGOLO_LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY=YOUR_ANTHROPIC_KEY
wigolo search "explain quantum tunnelling" --format answer

```

### OpenAI

OpenAI integration supports GPT-4o and other models via the standard API.

- **Required variable**: `OPENAI_API_KEY`
- **Default model**: `gpt-4o`
- **Implementation**: [`src/integrations/cloud/llm/openai.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/openai.ts)

```bash
export WIGOLO_LLM_PROVIDER=openai
export OPENAI_API_KEY=YOUR_OPENAI_KEY
wigolo search "best practices for Dockerfile layering" --format answer

```

### Ollama (Local)

Ollama allows running synthesis entirely locally without external API keys.

- **Required variable**: None (uses local server)
- **Base URL**: `WIGOLO_LLM_BASE_URL` (defaults to `http://localhost:11434`)
- **Default model**: Provider default (e.g., `llama3:8b`)
- **Implementation**: [`src/integrations/cloud/llm/ollama.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/ollama.ts) (handled via OpenAI-compatible client)

```bash
export WIGOLO_LLM_PROVIDER=ollama
export WIGOLO_LLM_BASE_URL=http://localhost:11434
wigolo search "summarize the Rust book chapter 4" --format answer

```

## Configuration Methods

You can configure Wigolo through command-line exports, persistent config, or JSON files.

### Command-Line Usage

Set environment variables inline for one-off searches:

```bash
WIGOLO_LLM_PROVIDER=gemini GEMINI_API_KEY=xxx wigolo search "query" --format answer

```

### Persistent Configuration

Use the built-in config command to store settings securely:

```bash

# Interactive TUI

wigolo config

# Headless configuration

wigolo config --set WIGOLO_LLM_PROVIDER=gemini
wigolo config --set GEMINI_API_KEY=YOUR_GEMINI_KEY

```

Keys are stored in the OS keychain, not in plaintext configuration files.

### JSON Configuration File

For advanced use cases, create `~/.wigolo/config.json`:

```json
{
  "WIGOLO_LLM_PROVIDER": "openai",
  "WIGOLO_LLM_MODEL": "gpt-4o"
}

```

Point to a custom location using `WIGOLO_CONFIG_PATH`. Note that API keys should still be supplied via environment variables or the keychain, not this JSON file.

## How Provider Selection Works

The selection logic resides in [`src/search/answer-synthesis.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/search/answer-synthesis.ts) lines 239-262. The flow follows these steps:

1. **Read** `WIGOLO_LLM_PROVIDER` from environment variables.
2. **Load** the corresponding adapter function (`callGemini`, `callAnthropic`, `callOpenAI`, or Ollama handler).
3. **Resolve** the API key from provider-specific environment variables or the generic `WIGOLO_LLM_API_KEY`.
4. **Override** the default model if `WIGOLO_LLM_MODEL` is set.
5. **Execute** the LLM call, cache the result per `WIGOLO_LLM_CACHE_TTL_DAYS`, and return the synthesized answer.

This architecture keeps the search, fetch, and crawl pipelines completely keyless while isolating LLM dependencies to the synthesis stage.

## Summary

- Wigolo only requires LLM configuration for the answer synthesis step triggered by `--format answer` or `research`/`agent` commands.
- Set `WIGOLO_LLM_PROVIDER` to `gemini`, `anthropic`, `openai`, or `ollama` to select your backend.
- Provide API keys via provider-specific environment variables or the generic `WIGOLO_LLM_API_KEY` stored in the OS keychain.
- Use `WIGOLO_LLM_MODEL` to override default models like `gemini-2.5-flash-lite`, `claude-3-5-sonnet-20240620`, or `gpt-4o`.
- Configure Ollama locally by pointing `WIGOLO_LLM_BASE_URL` to your server endpoint (default `http://localhost:11434`).
- When no provider is configured, Wigolo falls back to keyless mode returning raw briefs instead of synthesized answers.

## Frequently Asked Questions

### Do I need an API key to use all Wigolo features?

No. According to the source code, Wigolo's search, fetch, crawl, and embedding pipelines are completely keyless. You only need an API key when using `format: "answer"` or the `research`/`agent` commands that trigger answer synthesis. Without a key, Wigolo returns a raw brief with source evidence instead of a written answer.

### Can I use a custom OpenAI-compatible endpoint instead of Ollama?

Yes. While Ollama is the documented local option, you can point `WIGOLO_LLM_PROVIDER=ollama` and set `WIGOLO_LLM_BASE_URL` to any OpenAI-compatible API endpoint. This allows integration with custom proxies or alternative hosting solutions that follow the OpenAI API specification.

### How does Wigolo store my API keys securely?

When using `wigolo config --set`, keys are stored in your operating system's native keychain (Keychain on macOS, Credential Manager on Windows, or Secret Service on Linux) rather than plaintext files. The generic `WIGOLO_LLM_API_KEY` slot is populated by `wigolo init --provider` and retrieved securely at runtime.

### What happens if I set the provider but not the model?

Wigolo uses provider-specific defaults defined in the adapter files. For Gemini it defaults to `gemini-2.5-flash-lite`, for Anthropic `claude-3-5-sonnet-20240620`, and for OpenAI `gpt-4o`. Ollama uses whatever default model is configured on your local server. You can override these by setting `WIGOLO_LLM_MODEL`.