Skip to content

Create an LLM Monitoring Application


  1. Go to Agent Monitoring > Application List;
  2. Click Create;
  3. Select the LLM Monitoring Application tab.

Integration Types

On the Create Application page, integration with Langfuse is supported by default:

Access Configuration

Three options are supported here:

Python

JS/TS

Other Models/Frameworks

Access via Python

1. Install Dependencies

pip install langfuse

2. Initialize the Client

Set the following environment variables in your application environment:

LANGFUSE_PUBLIC_KEY="app_id"
LANGFUSE_SECRET_KEY="llm_bb0f30d.....66eec"
LANGFUSE_HOST="https://llm-openway.guance.com"

Initialize in your code:

from langfuse import Langfuse
langfuse = Langfuse()

Pass configuration parameters directly in your code:

from langfuse import Langfuse
langfuse = Langfuse(
  public_key="app_id",
  secret_key="llm_bb0f30d.....66eec",
  host="https://llm-openway.guance.com"
)

3. Verify the Connection

You can use langfuse.auth_check() to verify whether the integration is successful. It is not recommended for production use, as it adds latency to your application.

from langfuse import Langfuse
# Initialize (using constructor arguments)
langfuse = Langfuse(
    public_key="app_id",
    secret_key="llm_d9f06c320a9***6e9807",
    host="https://llm-openway.guance.com"
)
# Verify the connection. This is a synchronous call and is not recommended for production. This method is only for validating the configuration.
if langfuse.auth_check():
    print("Langfuse client is authenticated and ready!")

If the integration fails, you may encounter the following error:

langfuse.api.resources.commons.errors.unauthorized_error.UnauthorizedError: status_code: 401, body: {}

This error usually indicates that the App ID or Client Token is incorrect. Please check your parameter configuration.

For more detailed information and end-to-end examples, see Python.

Access via JS/TS

Note

This configuration only applies to the Langfuse JS/TS SDK v4. Version 3 is not supported.

1. Install Dependencies

npm install @langfuse/tracing @langfuse/otel @opentelemetry/sdk-node

Click to view more package information.

2. Register Credentials

Set the following environment variables in your application environment. Make sure you have a .env file in your project root directory and a package like dotenv to load the variables.

LANGFUSE_SECRET_KEY="llm_122f6b85d0c7454fa0f9*****d360"
LANGFUSE_PUBLIC_KEY="pk-lf-..."
LANGFUSE_BASE_URL="https://llm-openway.guance.com"

3. Initialize OpenTelemetry

The Langfuse SDK tracing is built on top of OpenTelemetry, so you need to set up the OpenTelemetry SDK. LangfuseSpanProcessor is the key component for sending traces to Langfuse.

import { NodeSDK } from "@opentelemetry/sdk-node";
import { LangfuseSpanProcessor } from "@langfuse/otel";
const sdk = new NodeSDK({
  spanProcessors: [new LangfuseSpanProcessor()],
});
sdk.start();

Click to view the Ollama integration example.

For more detailed information and end-to-end examples, see JS/TS.

Access via Other

If you need to integrate other models/frameworks, such as DeepSeek, Ollama, LangChain, Dify, etc., see the official Langfuse documentation for configuration.

LangChain OpenTelemetry Integration

LangChain applications can be integrated via OpenTelemetry. After the integration is complete, you can view call traces, input, output, and token consumption in LLM Monitoring.

The system parses the OpenTelemetry gen_ai attributes and displays:

  • Input: The input content of the model call;
  • Output: The output content returned by the model;
  • Token: Input, output, and total token consumption;
  • Related information such as model, service, and call status.
Note

What is displayed on the page depends on whether the reported data contains the corresponding gen_ai attributes. Fields that are not reported are not displayed, and this does not affect queries of other trace data.

Fill in the Variables in the Code

Fill in the following information on the right side of the page:

Field Description
Application Name Custom application name
Application ID Public key. Only letters, numbers, and underscores are supported. Used to attribute data to the current application in traces, logs, and metrics.
Service Address The Dataway gateway address
Client Token Automatically generated after the application is created. Used to send data from user devices.
What is a Client Token?

After you create an application, the system automatically generates a Client Token for you. This token is used to send data from user devices.

For more details, see Client Token Management.

After confirming that the information is correct, click Create to complete the LLM Monitoring application integration.

Feedback

Is this page helpful?