> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ItzCrazyKns/Perplexica/llms.txt
> Use this file to discover all available pages before exploring further.

# Models and providers

> Configure LLM providers including Ollama, OpenAI, Anthropic, Gemini, Groq, and more

Perplexica supports multiple LLM providers for both chat and embedding models. You can configure providers through the settings UI or environment variables.

## Supported providers

Perplexica supports the following LLM providers:

* **Ollama** - Local LLM server for running models on your own hardware
* **OpenAI** - GPT models including GPT-4, GPT-4o, and GPT-3.5 Turbo
* **Anthropic** - Claude models from Anthropic
* **Gemini** - Google's Gemini models
* **Groq** - Fast LLM inference service
* **LM Studio** - Local LLM server with OpenAI-compatible API
* **Lemonade** - Self-hosted LLM server
* **Transformers** - Browser-based embedding models (no chat support)

## Configuring providers

<Note>
  Providers are configured during the initial setup screen when you first launch Perplexica. You can also add or modify providers later through the settings UI.
</Note>

Each provider requires different configuration parameters:

### Ollama

Run local LLM models on your own hardware using Ollama.

<ParamField path="baseURL" type="string" required>
  The base URL for your Ollama server

  **Docker users:**

  * Windows/Mac: `http://host.docker.internal:11434`
  * Linux: `http://<your-host-ip>:11434`

  **Non-Docker users:**

  * `http://localhost:11434`
</ParamField>

<Accordion title="Troubleshooting Ollama connection">
  If you're encountering connection errors:

  1. Verify the API URL is correct in settings
  2. Use the correct URL format for your operating system (see above)
  3. **Linux users**: Expose Ollama to the network by adding `Environment="OLLAMA_HOST=0.0.0.0:11434"` to `/etc/systemd/system/ollama.service`, then run:
     ```bash theme={null}
     systemctl daemon-reload
     systemctl restart ollama
     ```
  4. Ensure port 11434 is not blocked by your firewall
</Accordion>

**Environment variable:** `OLLAMA_BASE_URL`

### OpenAI

Use OpenAI's GPT models or OpenAI-compatible APIs.

<ParamField path="apiKey" type="string" required>
  Your OpenAI API key
</ParamField>

<ParamField path="baseURL" type="string" required>
  The base URL for the OpenAI API

  **Default:** `https://api.openai.com/v1`

  For OpenAI-compatible servers, use your custom URL.
</ParamField>

**Environment variables:**

* `OPENAI_API_KEY`
* `OPENAI_BASE_URL`

**Available models:**

* GPT-3.5 Turbo
* GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o Mini
* GPT-4.1, GPT-4.1 Mini, GPT-4.1 Nano
* GPT-5 series (Nano, Mini, Pro, 5.1, 5.2, 5.2 Pro)
* o1, o3, o3 Mini, o4 Mini
* Text Embedding 3 Small/Large (embeddings)

<Warning>
  For local OpenAI-compatible servers:

  1. Ensure your server runs on `0.0.0.0` (not `127.0.0.1`)
  2. Specify the correct model name loaded by your server
  3. Provide an API key (use any non-empty value if not required)
</Warning>

### Anthropic

Use Claude models from Anthropic.

<ParamField path="apiKey" type="string" required>
  Your Anthropic API key
</ParamField>

**Environment variable:** `ANTHROPIC_API_KEY`

<Note>
  Anthropic models are fetched dynamically from the API. The provider automatically retrieves available Claude models when configured.
</Note>

### Gemini

Use Google's Gemini models.

<ParamField path="apiKey" type="string" required>
  Your Google AI API key for Gemini
</ParamField>

**Environment variable:** `GEMINI_API_KEY`

<Note>
  Gemini supports both chat and embedding models. Available models are fetched automatically from the Gemini API.
</Note>

### Groq

Fast LLM inference with Groq.

<ParamField path="apiKey" type="string" required>
  Your Groq API key
</ParamField>

**Environment variable:** `GROQ_API_KEY`

<Note>
  Groq only supports chat models, not embeddings. Available models are fetched from the Groq API.
</Note>

### LM Studio

Local LLM server with OpenAI-compatible API.

<ParamField path="baseURL" type="string" required>
  The base URL for your LM Studio server

  **Default:** `http://localhost:1234`

  The `/v1` suffix is added automatically if not present.
</ParamField>

**Environment variable:** `LM_STUDIO_BASE_URL`

<Tip>
  LM Studio provides both chat and embedding model support. Models are automatically detected from your running LM Studio server.
</Tip>

### Lemonade

Self-hosted LLM server.

<ParamField path="baseURL" type="string" required>
  The base URL for your Lemonade server

  **Example:** `https://api.lemonade.ai/v1`
</ParamField>

<ParamField path="apiKey" type="string">
  Your Lemonade API key (optional)
</ParamField>

**Environment variables:**

* `LEMONADE_BASE_URL`
* `LEMONADE_API_KEY` (optional)

<Accordion title="Troubleshooting Lemonade connection">
  If you're encountering connection errors:

  1. Verify the API URL in settings
  2. Use the correct URL format for your OS:
     * Windows/Mac (Docker): `http://host.docker.internal:8000`
     * Linux (Docker): `http://<your-host-ip>:8000`
  3. Ensure Lemonade server is running and accessible
  4. Verify Lemonade accepts connections from all interfaces (`0.0.0.0`)
  5. Check that port 8000 is not blocked by firewall
</Accordion>

### Transformers

Browser-based embedding models using Transformers.js.

<Note>
  Transformers requires no configuration and provides embedding models only (no chat support).
</Note>

**Available embedding models:**

* all-MiniLM-L6-v2 (`Xenova/all-MiniLM-L6-v2`)
* mxbai-embed-large-v1 (`mixedbread-ai/mxbai-embed-large-v1`)
* nomic-embed-text-v1 (`Xenova/nomic-embed-text-v1`)

## Adding custom models

You can add custom models to any configured provider:

<Steps>
  <Step title="Open settings">
    Navigate to the settings page in Perplexica
  </Step>

  <Step title="Select provider">
    Find the provider you want to add a model to
  </Step>

  <Step title="Add model">
    Click "Add Custom Model" and enter:

    * **Model Name**: Display name for the model
    * **Model Key**: The actual model identifier used by the API
    * **Type**: Chat or Embedding
  </Step>

  <Step title="Save">
    Save your changes. The custom model will be available for selection.
  </Step>
</Steps>

## Managing providers

### Add a new provider

You can add multiple instances of the same provider type (e.g., two different OpenAI configurations):

1. Open settings and navigate to the providers section
2. Click "Add Provider"
3. Select the provider type
4. Configure the required parameters
5. Give the provider a descriptive name
6. Save the configuration

### Update provider settings

To modify an existing provider:

1. Navigate to settings
2. Find the provider you want to update
3. Click "Edit"
4. Update the configuration parameters
5. Save your changes

### Remove a provider

<Warning>
  Removing a provider will make its models unavailable. Any searches or chats configured to use models from this provider will fail.
</Warning>

To remove a provider:

1. Navigate to settings
2. Find the provider you want to remove
3. Click "Delete" or "Remove"
4. Confirm the deletion

## Environment variable configuration

Instead of configuring providers through the UI, you can set them using environment variables. When environment variables are detected, providers are automatically configured on startup.

<Accordion title="Example Docker configuration">
  ```bash theme={null}
  docker run -d -p 3000:3000 \
    -e OPENAI_API_KEY="your-api-key" \
    -e OPENAI_BASE_URL="https://api.openai.com/v1" \
    -e ANTHROPIC_API_KEY="your-anthropic-key" \
    -e OLLAMA_BASE_URL="http://host.docker.internal:11434" \
    -v perplexica-data:/home/perplexica/data \
    --name perplexica \
    itzcrazykns1337/perplexica:latest
  ```
</Accordion>

See the [environment variables reference](/configuration/environment-variables) for a complete list of available variables.
