Integration

Chainlit with Meridian

Drop Meridian's observability into your Chainlit app with a single base URL swap.

chainlit_app.py
from openai import AsyncOpenAI
import chainlit as cl

client = AsyncOpenAI(
    api_key="sk-meridian-...",
    base_url="https://api.meridian.ai/v1",
)

@cl.on_message
async def on_message(msg: cl.Message):
    stream = await client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": msg.content}],
        stream=True,
    )
    response = cl.Message(content="")
    async for chunk in stream:
        if chunk.choices[0].delta.content:
            await response.stream_token(
                chunk.choices[0].delta.content
            )
    await response.send()

Replace api_key and base_url with your Meridian project credentials. All traces, token counts, and latencies appear in your dashboard automatically.