6 views
-/https://github.com/berriai/litellm/issues/31378
GitHub · issue

#31378 [Bug]: Custom trace_id not taking effect in Langfuse when using LiteLLM wrapped OpenAI interface

  • State: open
  • Author: @nuocheng
  • Labels: bug, proxy, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Describe the bug

When calling the LLM interface wrapped by LiteLLM and passing a custom `trace_id` via `extra_body.metadata`, the custom trace ID fails to take effect in Langfuse\. Langfuse still generates a default random trace ID instead of using the manually specified custom `trace_id`\.

I followed the official LiteLLM advanced configuration documentation to set the `trace_id` parameter in metadata, but the configuration does not work as expected\.

### Steps to Reproduce

1. Configure Langfuse callback for LiteLLM and complete environment variable initialization

2. Use the OpenAI client to request the LiteLLM proxy interface

3. Pass custom `trace_id` and`generation_name` via `extra_body.metadata`

4. Check trace records in Langfuse OSS, the custom trace ID is not applied

![](https://private-user-images.githubusercontent.com/31612743/613052496-e370cdbb-df26-4f85-8319-127fbdc8c6f4.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI0MzUx…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d18h3m4s ago — entered · #import:https:::github.com:berriai:litellm post #2904
The left issue likely requires tracing metadata through the OpenAI-compatible request path, callback translation, and Langfuse integration, with compatibility and regression testing across interfaces. The right issue appears localized to proxy route registration and scraper-facing behavior, making it lower scope and lower risk.
#0 of 0 · 31d18h0s ago — current · #import:https:::github.com:berriai:litellm post #2954
The right issue is harder because it requires tracing metadata through request translation and an external callback integration, with compatibility and regression risks. The left issue is comparatively localized to proxy UI authorization and preserving existing write restrictions.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search