# Supported LLM Providers for Synthesis in Wigolo: A Complete Configuration Guide

> Configure supported LLM providers like Anthropic, OpenAI, Gemini, and Groq for synthesis in Wigolo. Learn setup with environment variables, keystore, or JSON config.

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

---

**Wigolo supports four built‑in cloud LLM providers—Anthropic, OpenAI, Gemini, and Groq—plus key‑less custom backends like Ollama, configurable via environment variables, a secure keystore, or a persisted JSON configuration file.**

The open‑source project **KnockOutEZ/wigolo** synthesizes answers by routing queries to large language models. According to the source code in [`src/integrations/cloud/llm/types.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/types.ts), the `LLMProvider` type is explicitly limited to `'anthropic' | 'openai' | 'gemini' | 'groq'`, giving users a predictable set of integrations while allowing extensibility through custom HTTP endpoints.

## Built‑In Cloud LLM Providers

Wigolo ships with native support for four commercial providers. Each requires a specific API key environment variable, although aliases and fallback mechanisms exist.

### Anthropic

**Provider identifier:** `anthropic`  
**Canonical environment variable:** `ANTHROPIC_API_KEY`

Defined in the `PROVIDER_ENV` map located in [`src/integrations/cloud/llm/select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/select.ts), this provider routes synthesis requests to Anthropic’s Claude models. No alias variables are supported.

### OpenAI

**Provider identifier:** `openai`  
**Canonical environment variable:** `OPENAI_API_KEY`

As implemented in [`select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/select.ts), OpenAI is the second provider in the auto‑detection array. Wigolo looks for this key in the system keychain, file store, or environment when resolving credentials.

### Gemini (Google)

**Provider identifier:** `gemini`  
**Canonical environment variable:** `GEMINI_API_KEY`  
**Backward‑compatible alias:** `GOOGLE_API_KEY`

The Gemini integration accepts either the modern `GEMINI_API_KEY` or the legacy `GOOGLE_API_KEY` for flexibility, with the canonical variable taking precedence during resolution.

### Groq

**Provider identifier:** `groq`  
**Canonical environment variable:** `GROQ_API_KEY`

Groq is included in the hard‑coded provider order in [`select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/select.ts), enabling low‑latency synthesis when the corresponding key is present.

## How Provider Selection Works

The resolution logic lives in **[`src/integrations/cloud/llm/select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/select.ts)**. Wigolo determines which LLM to use by evaluating three sources in strict priority order:

1.  **Explicit override** – If `WIGOLO_LLM_PROVIDER` is set to a valid identifier (`anthropic`, `openai`, `gemini`, `groq`) and a corresponding key (or the generic `WIGOLO_LLM_API_KEY`) is available, that provider is selected immediately.
2.  **Persisted configuration** – If [`config.json`](https://github.com/KnockOutEZ/wigolo/blob/main/config.json) contains a `settings.llmProvider` field, Wigolo attempts to resolve a stored key for that specific provider via the keystore module.
3.  **Auto‑detect** – The system iterates through the fixed array `['anthropic','openai','gemini','groq']` and selects the first provider whose key exists in the keychain, file store, or environment.

The `PROVIDER_ENV` constant in [`select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/select.ts) maps each provider to its canonical environment variable:

```ts
const PROVIDER_ENV: Record<LLMProvider, string> = {
  anthropic: 'ANTHROPIC_API_KEY',
  openai: 'OPENAI_API_KEY',
  gemini: 'GEMINI_API_KEY',
  groq: 'GROQ_API_KEY',
};

```

## Configuring API Keys

Wigolo offers three mechanisms for supplying credentials, managed by the **key‑store module** in [`src/security/key-store.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/security/key-store.ts).

### Environment Variables

Export the provider‑specific variable before running Wigolo. This method is ideal for CI/CD pipelines or temporary testing.

```bash
export WIGOLO_LLM_PROVIDER=openai
export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
wigolo run my-task

```

### Persistent Key Storage

For long‑term use, store keys securely outside of shell history using the CLI helper:

```bash
wigolo key store gemini sk-XXXXXXXXXXXXXXXX

```

When a key exists in the keystore, it takes precedence over environment variables for that provider. The `STORE_PROVIDERS` constant in [`src/security/key-store.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/security/key-store.ts) defines which providers support this storage method.

### Configuration File

Initialize a [`config.json`](https://github.com/KnockOutEZ/wigolo/blob/main/config.json) file (generated via `wigolo init`) to set a default provider:

```json
{
  "settings": {
    "llmProvider": "gemini"
  }
}

```

Wigolo will automatically resolve the stored Gemini key when this configuration is present.

## Custom Backend and Local LLMs

If `WIGOLO_LLM_PROVIDER` is set to an HTTP(S) URL or the special alias `ollama`, Wigolo bypasses key lookup and routes synthesis calls to a custom backend. This logic is handled by **[`src/integrations/cloud/llm/custom-backend.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/custom-backend.ts)**, enabling key‑less operation with local or self‑hosted models.

Enable Ollama integration:

```bash
export WIGOLO_LLM_PROVIDER=ollama
wigolo run my-task

```

Point to a self‑hosted endpoint:

```bash
export WIGOLO_LLM_PROVIDER=https://my-local-llm.example.com/v1
wigolo run my-task

```

## Practical Configuration Examples

### Selecting Anthropic via Environment

```bash
export WIGOLO_LLM_PROVIDER=anthropic
export ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxx
wigolo query "Explain TypeScript generics"

```

### Using Gemini with Persistent Storage

```bash

# Store the key once

wigolo key store gemini AIzaXXXXXXXXXXXXXXXX

# Set the provider in config.json (or via env)

export WIGOLO_LLM_PROVIDER=gemini
wigolo run ./my-task.yaml

```

### Programmatic Key Storage

For applications embedding Wigolo, store provider keys via the internal API:

```ts
import { storeProviderKey } from 'wigolo';

await storeProviderKey('openai', 'sk-abc123', { dataDir: '/path/to/store' });

```

### Resolving Provider Selection Internally

To inspect which provider Wigolo selected and which key it retrieved:

```ts
import { selectProviderWithKeyStore } from './src/integrations/cloud/llm/select.js';

const result = await selectProviderWithKeyStore(process.env, { dataDir: '/tmp' });
if (result) {
  console.log(`Using ${result.provider} with key ${result.key}`);
}

```

## Summary

-   **Four cloud providers** are officially supported: **Anthropic**, **OpenAI**, **Gemini**, and **Groq**, defined in [`src/integrations/cloud/llm/types.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/types.ts).
-   **Resolution priority** is: explicit `WIGOLO_LLM_PROVIDER` override → persisted [`config.json`](https://github.com/KnockOutEZ/wigolo/blob/main/config.json) → auto‑detection based on key availability, as implemented in [`src/integrations/cloud/llm/select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/select.ts).
-   **API keys** can be provided via environment variables, the secure keystore ([`src/security/key-store.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/security/key-store.ts)), or the generic `WIGOLO_LLM_API_KEY` fallback.
-   **Custom backends** like Ollama or self‑hosted URLs are supported without API keys through [`src/integrations/cloud/llm/custom-backend.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/custom-backend.ts).

## Frequently Asked Questions

### How do I switch between OpenAI and Anthropic without editing config files?

Set the `WIGOLO_LLM_PROVIDER` environment variable to the desired identifier (`openai` or `anthropic`) and ensure the corresponding `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` is exported. This explicit override takes precedence over any persisted configuration.

### Can I use Google AI Studio keys with Wigolo?

Yes. Wigolo accepts both `GEMINI_API_KEY` (preferred) and the backward‑compatible `GOOGLE_API_KEY` environment variables for the Gemini provider. Store either variable in your environment or use `wigolo key store gemini <key>` for persistent storage.

### What happens if multiple provider keys are present but no explicit selection is made?

The system auto‑detects the first available provider in the fixed order: Anthropic → OpenAI → Gemini → Groq. This logic in [`src/integrations/cloud/llm/select.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/select.ts) checks the keystore, file store, and environment variables in sequence until it finds a valid key.

### Is it possible to use a local LLM like Llama 3 without cloud API keys?

Yes. Set `WIGOLO_LLM_PROVIDER` to `ollama` or a specific HTTP URL (e.g., `http://localhost:11434/v1`). When a URL or the `ollama` alias is detected, Wigolo skips API key validation entirely and routes requests to your local backend via [`src/integrations/cloud/llm/custom-backend.ts`](https://github.com/KnockOutEZ/wigolo/blob/main/src/integrations/cloud/llm/custom-backend.ts).