By default, your Chainlit app does not persist the chats and elements it generates. However, the ability to store and utilize this data can be a crucial part of your project or organization.

Once enabled, data persistence will introduce new features to your application.


Enable Data Persistence in 1 minute

  1. Navigate to Literal AI and sign in.
  2. You will be prompted to create a new project:

    Project Creation Screen

  3. Navigate to the Settings page. A default API key will be generated for you

    Project API Key


Once you have an API key, you will need to pass it via a LITERAL_API_KEY environment variable.

Next to your Chainlit application, create a .env file and modify it like so:

LITERAL_API_KEY="your key"

Or inlined:

LITERAL_API_KEY="your key" chainlit run

Or inlined for Windows powershell:

$ENV:LITERAL_API_KEY="your key"; chainlit run

Once activated, your chats and elements will be persisted on Literal AI.


If you wish to deactivate data persistence, simply comment out or remove the LITERAL_API_KEY environment variable.

Data privacy & security

We prioritize your data’s privacy and security. We understand how crucial the data fed into Chainlit Cloud is for your business and handle it with utmost care.

Contact us for detailed information: