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

# Installation

> Install LangChat and configure your environment.

## Requirements

| Requirement  | Version                                                     |
| ------------ | ----------------------------------------------------------- |
| Python       | 3.9 or higher                                               |
| Pinecone     | Account with an index created                               |
| Supabase     | Empty project (tables created automatically)                |
| LLM provider | OpenAI, Anthropic, Gemini, Mistral, Cohere, or local Ollama |

## Install LangChat

<CodeGroup>
  ```bash pip theme={null}
  pip install langchat
  ```

  ```bash uv theme={null}
  uv pip install langchat
  ```
</CodeGroup>

### Install uv (recommended)

[uv](https://docs.astral.sh/uv/) is a fast Python package manager that replaces pip and venv.

<CodeGroup>
  ```bash macOS / Linux theme={null}
  curl -LsSf https://astral.sh/uv/install.sh | sh
  ```

  ```powershell Windows theme={null}
  powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
  ```
</CodeGroup>

## Virtual environment

<CodeGroup>
  ```bash uv theme={null}
  uv venv
  source .venv/bin/activate      # macOS / Linux
  .venv\Scripts\activate         # Windows
  uv pip install langchat
  ```

  ```bash pip + venv theme={null}
  python -m venv .venv
  source .venv/bin/activate      # macOS / Linux
  .venv\Scripts\activate         # Windows
  pip install langchat
  ```
</CodeGroup>

## Environment variables

Create a `.env` file in your project root. All providers read credentials automatically — you never pass keys directly in code.

```bash .env theme={null}
# ─── LLM providers (add whichever you use) ───────────────────────
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...          # also accepted: GOOGLE_API_KEY
MISTRAL_API_KEY=...
COHERE_API_KEY=...
# Ollama needs no key — runs locally

# ─── Vector database ─────────────────────────────────────────────
PINECONE_API_KEY=pcsk-...

# ─── History database ────────────────────────────────────────────
SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_KEY=eyJhbGc...         # also accepted: SUPABASE_SERVICE_ROLE_KEY

# ─── Embeddings (required for document indexing) ─────────────────
# Reuses OPENAI_API_KEY — no extra variable needed
```

Load `.env` in your script with one line:

```python theme={null}
from langchat import LangChat
LangChat.load_env()
```

Or use [python-dotenv](https://github.com/theskumar/python-dotenv):

```python theme={null}
from dotenv import load_dotenv
load_dotenv()
```

<Warning>
  Add `.env` to your `.gitignore`. Never commit API keys.
</Warning>

## Pinecone setup

You need a Pinecone index before LangChat can store or retrieve documents.

1. Sign up at [pinecone.io](https://pinecone.io)
2. Create a **Serverless** index with these settings:
   * **Dimensions**: `3072` for `text-embedding-3-large` (default) or `1536` for `text-embedding-3-small`
   * **Metric**: `cosine`
3. Add `PINECONE_API_KEY` to your `.env`

## Supabase setup

LangChat creates its tables automatically — you just need a project.

1. Create a project at [supabase.com](https://supabase.com)
2. Copy **Project URL** and **anon key** (or `service_role` key for server-side usage)
3. Add `SUPABASE_URL` and `SUPABASE_KEY` to your `.env`

On first run, LangChat creates:

* `chat_history` — stores conversation messages
* `request_metrics` — stores latency and error data

## Verify installation

```python theme={null}
import langchat
print(langchat.__version__)
```

## Next steps

* [Quick Start](/quick-start) — your first chatbot in 5 minutes
* [Configuration](/guides/configuration) — configure every provider
