Novita AI & Langfuse Integration Guide
Step-by-step guide to set up Langfuse with Novita AI to develop, monitor, evaluate, and debug AI applications.
With Langfuse, your team can collaboratively debug, analyze, and iterate on their LLM applications built with Novita AI. Its fully integrated features streamline the development workflow, enhancing efficiency and accelerating progress.
This guide shows you how to integrate Novita AI with Langfuse. Novita AI’s API endpoints for chat, language and code are fully compatible with OpenAI’s API. This allows us to use the Langfuse OpenAI drop-in replacement to trace all parts of your application.
Prerequisites
Before you begin, make sure you have the following:
-
Novita AI LLM API Key:
-
Visit Novita AI’s website to create an account.
-
Log in and go to the Key Management page to generate your API Key, which is essential for integrating Novita AI’s models with Langfuse.
-
-
Langfuse Account:
- Sign up for a Langfuse account on the official Langfusewebsite to start building powerful AI applications.
Integration Steps
Step 1: Install Dependencies
Ensure you have installed all the required Python packages:
Step 2: Set Up Environment Variables
Step 3: Langfuse OpenAI drop-in Replacement
In this step we use the native OpenAI drop-in replacement by importing from langfuse.openai import openai
.
To start using Novita AI with OpenAI’s client libraries, pass in your Novita AI API key to the api_key
option, and change the base_url
to https://api.novita.ai/v3/openai
:
Note: The OpenAI drop-in replacement is fully compatible with the Low-Level Langfuse Python SDKs and @observe()
decorator to trace all parts of your application.
Step 4: Run An Example
The following code cell shows how to use the traced OpenAI client to call Novita AI’s chat model. All API calls will be seamlessly traced by Langfuse.
Step 5: See Traces in Langfuse
After running the example model call, you can view the traces in Langfuse. These traces provide detailed information about your Novita AI API calls, including:
-
Request parameters (model, messages, temperature, etc.)
-
Response content
-
Token usage statistics
-
Latency metrics
Was this page helpful?