DocsIntegrationsOpenAI SDKPythonTrack Errors

Tracking of OpenAI API errors

Langfuse Langfuse automatically tracks and monitors OpenAI API errors if you use the native integration. They are captured via the level and statusMessage fields (see docs).

Learn more about how to get started here.

- import openai
+ from langfuse.openai import openai
# Cause an error by attempting to use a host that does not exist.
openai.base_url = "https://example.com"
 
country = openai.chat.completions.create(
  name="will-error",
  model="gpt-3.5-turbo",
  messages=[
      {"role": "user", "content": "How are you?"}],
)

Throws error 👆

Openai error

Was this page useful?

Questions? We're here to help

Subscribe to updates