Quick Start

Get observability on your LLM calls in under 2 minutes.

  1. Install the SDK

    npm install weflayr
    
    pip install weflayr
    
  2. Get your credentials

    Your Flayr credentials are in the Weflayr app under My Flayrs. Pass them directly to weflayr_setup, or load them from environment variables via dotenv:

    # .env
    WEFLAYR_INTAKE_URL=https://api.weflayr.com
    WEFLAYR_CLIENT_ID=your-client-id
    WEFLAYR_CLIENT_SECRET=your-client-secret
    
  3. Configure and instrument your client

    const OpenAI = require('openai');
    const { weflayr_setup, weflayr_instrument } = require('weflayr');
    
    weflayr_setup({
      intake_url:    process.env.WEFLAYR_INTAKE_URL,
      client_id:     process.env.WEFLAYR_CLIENT_ID,
      client_secret: process.env.WEFLAYR_CLIENT_SECRET,
      default_tags: {
        app: 'my-app',
        version: '1.0.0',
      },
      methods: [
        { call: 'chat.completions.create' },
      ],
    });
    
    const client = weflayr_instrument(new OpenAI({ apiKey: process.env.OPENAI_API_KEY }));
    
    import os
    from openai import OpenAI
    from weflayr import weflayr_setup, weflayr_instrument
    
    weflayr_setup({
        "intake_url":    os.environ["WEFLAYR_INTAKE_URL"],
        "client_id":     os.environ["WEFLAYR_CLIENT_ID"],
        "client_secret": os.environ["WEFLAYR_CLIENT_SECRET"],
        "default_tags": {
            "app": "my-app",
            "version": "1.0.0",
        },
        "methods": [
            {"call": "chat.completions.create"},
        ],
    })
    
    client = weflayr_instrument(OpenAI(api_key=os.environ["OPENAI_API_KEY"]))
    

    weflayr_setup must be called before weflayr_instrument. The methods array is the whitelist — only listed call paths are instrumented. default_tags are attached to every event automatically — see Propagate for runtime tagging.

  4. Make a call and telemetry will be automatic

    const response = await client.chat.completions.create({
      model: 'gpt-4o-mini',
      messages: [{ role: 'user', content: 'Hello!' }],
      __weflayr_tags: {
          provider: 'openai',
          feature: 'onboarding',
          customer_id: '#3756'
        },
    });
    // response is the standard OpenAI response object — unchanged
    
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": "Hello!"}],
        __weflayr_tags={
            "provider": "openai",
            "feature": "onboarding",
            "customer_id": "#3756",
        },
    )
    # response is the standard OpenAI response object — unchanged
    

    __weflayr_tags is stripped before forwarding to OpenAI and attached to the telemetry events.