> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inquantum.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Automatic Model Call Logging

> Automatically send model-call traces to Planck while your application continues calling providers directly.

Use the Planck Async Logger to observe existing model calls without routing them
through the Planck AI Gateway. Your application continues calling OpenAI,
Anthropic, or another supported provider directly, and the logger sends trace
data to Planck in the background.

<Note>
  This is a Planck integration. Install `@inquantum/planck-async` for Node.js or
  `planck-async` for Python. No additional logging service or account is
  required.
</Note>

## Set up automatic logging

<Tabs>
  <Tab title="Node.js">
    <Steps>
      <Step title="Install the Planck Async Logger">
        ```bash theme={null}
        npm install @inquantum/planck-async
        ```
      </Step>

      <Step title="Initialize Logger">
        ```typescript theme={null}
        import { PlanckAsyncLogger } from "@inquantum/planck-async";
        import OpenAI from "openai";

        const logger = new PlanckAsyncLogger({
          apiKey: process.env.PLANCK_API_KEY,
          // pass in the providers you want logged
          providers: {
            openAI: OpenAI,
            //anthropic: Anthropic,
            //cohere: Cohere
            // ...
          }
        });
        logger.init();

        const openai = new OpenAI();

        async function main() {
          const completion = await openai.chat.completions.create({
            messages: [
              {"role": "system", "content": "You are a helpful assistant."},
              {"role": "user", "content": "Who won the world series in 2020?"},
              {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
              {"role": "user", "content": "Where was it played?"}
            ],
            model: "gpt-4o-mini",
          });

          console.log(completion.choices[0]);
        }

        main();
        ```
      </Step>

      <Step title="Properties">
        You can set properties on the logger to be used in Planck using the `withProperties` method. (These can be used for [Sessions](/features/sessions), [User Metrics](/features/advanced-usage/user-metrics), and more.)

        ```typescript theme={null}
        const sessionId = randomUUID();

        logger.withProperties({
          "Planck-Session-Id": sessionId,
          "Planck-Session-Path": "/abstract",
          "Planck-Session-Name": "Course Plan",
        }, () => {
          const completion = await openai.chat.completions.create({
            // ...
          })
        })
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Python">
    <Steps>
      <Step title="Install the Planck Async Logger">
        ```bash theme={null}
        pip install planck-async
        ```
      </Step>

      <Step title="Initialize Logger">
        ```python theme={null}
        from planck_async import PlanckAsyncLogger
        from openai import OpenAI

        logger = PlanckAsyncLogger(
          api_key=PLANCK_API_KEY,
        )

        logger.init()

        client = OpenAI(api_key=OPENAI_API_KEY)

        # Make the OpenAI call
        response = client.chat.completions.create(
          model="gpt-4o-mini",
          messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Who won the world series in 2020?"},
            {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
            {"role": "user", "content": "Where was it played?"}
          ]
        )

        print(response.choices[0])
        ```
      </Step>

      <Step title="Properties">
        You can set properties on the logger to be used in Planck using the `set_properties` method. (These can be used for [Sessions](/features/sessions), [User Metrics](/features/advanced-usage/user-metrics), and more.)

        ```python theme={null}
        session_id = str(uuid.uuid4())

        logger.set_properties({
          "Planck-Session-Id": session_id,
          "Planck-Session-Path": "/abstract",
          "Planck-Session-Name": "Course Plan",
        })

        response = client.chat.completions.create(
          # ...
        )
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Disable logging

You can completely disable all logging to Planck if needed when using the async integration mode. This is useful for development environments or when you want to temporarily stop sending data to Planck without changing your code structure.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    # Disable all logging in async mode
    logger.disable_logging()

    # Later, re-enable logging if needed
    logger.enable_logging()
    ```
  </Tab>

  <Tab title="Node.js">
    Coming soon
  </Tab>
</Tabs>

When logging is disabled, no traces will be sent to Planck. This is different from `disable_content_tracing()` which only omits request and response content but still sends other metrics. Note that this feature is only available when using Planck's async integration mode.

## Supported providers

* [x] OpenAI
* [x] Anthropic
* [x] Azure OpenAI
* [x] Cohere
* [x] Bedrock
* [x] Google AI Platform

## Other integration options

* [Gateway Integration](/getting-started/integration-method/gateway)
