# Hindsight

Source: https://docs.aicentos.com/en/clients/hindsight

Language: en

> Give the Hindsight memory service an aicentos model — four environment variables and an OpenAI-compatible endpoint

Hindsight is an open-source agent memory system offering a self-hosted service, HTTP / MCP interfaces, an SDK, and a CLI. It is not a chat client itself, but **memory distillation needs an LLM**, and that LLM can point at aicentos.

## Prerequisites

First create a dedicated key for Hindsight in the console (naming it `hindsight` is recommended).

* Console: [https://aicentos.com](https://aicentos.com)
* Create a key: [https://aicentos.com/keys](https://aicentos.com/keys)
* Top up wallet: [https://aicentos.com/wallet](https://aicentos.com/wallet)

The Hindsight server requires PostgreSQL 14 or later. The bundled `pg0` is only suitable for development; in production, connect your own instance.

```bash
pip install hindsight-api
```

## Configuration to fill in

| Environment variable         | Value                                              |
| ---------------------------- | -------------------------------------------------- |
| `HINDSIGHT_API_LLM_PROVIDER` | `openai`                                           |
| `HINDSIGHT_API_LLM_BASE_URL` | `https://aicentos.com/v1`                          |
| `HINDSIGHT_API_LLM_API_KEY`  | The key created in the console                     |
| `HINDSIGHT_API_LLM_MODEL`    | A model name from the Model Gallery in the console |

## Setup steps

Just put them into the startup environment; no code changes are needed:

```bash
export HINDSIGHT_API_LLM_PROVIDER="openai"
export HINDSIGHT_API_LLM_BASE_URL="https://aicentos.com/v1"
export HINDSIGHT_API_LLM_API_KEY="sk-your-API-Key"
export HINDSIGHT_API_LLM_MODEL="your-model-name"

hindsight-api
```

When deploying with Docker, put these variables into the compose `environment`. Note that the official image does not include `llama.cpp`, so do not expect to run local models inside the container.

## Test

```bash
curl -fsSL https://hindsight.vectorize.io/get-cli | bash
hindsight health
```

Once the service is up, write one memory and retrieve it again; if that works end to end, LLM calls are working. You can also watch usage in the console directly: every memory Hindsight distills produces one request.

## Notes

* `BASE_URL` must end with `/v1`, and the upstream must be able to serve `/chat/completions`; writing `https://aicentos.com` returns 404.
* With no LLM key configured the service refuses to start; that is its hard validation, not a wrong key.
* Memory distillation is background batch work, so usage grows with the number of memories; give Hindsight its own key so it is easier to watch.
* Setting `HINDSIGHT_API_LLM_PROVIDER` to `openai` means the OpenAI-compatible protocol, not that only OpenAI models can be used.

## Related links

* [Hindsight model configuration](https://hindsight.vectorize.io/developer/models)
* [hindsight repository](https://github.com/vectorize-io/hindsight)