pip install literalai

Instantiate the Literal AI client

import os
from literalai import LiteralClient

# Not compatible with gunicorn's --preload flag
literal_client = LiteralClient(api_key=os.getenv("LITERAL_API_KEY")) # This is the default and can be omitted

How to get my API key?

To get your API key, go to your project page and click on the Settings tab. You will find your API key in the API Key section.

Log your first thread

import os
from literalai import LiteralClient

literal_client = LiteralClient(api_key=os.getenv("LITERAL_API_KEY"))

with literal_client.thread(name="My first thread !") as thread:
  literal_client.message(content="Hello world", type="user_message", name="My first step !")

literal_client.flush_and_stop()

You can now go to your project page and see your first thread.

Next up

Quick Start

Log your data to Literal AI