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

#29978 [Feature]: Map Codex session metadata to LiteLLM/Langfuse session fields

  • State: open
  • Author: @jlrigau
  • Labels: llm translation

## What problem are you trying to solve?

When using the `chatgpt` provider for Codex models through LiteLLM, Codex sends session metadata in the `x-codex-turn-metadata` request header.

Example header value:

```json { "session_id": "019ea92f-a0c5-7f53-8d6c-...", "thread_id": "019ea92f-a0c5-7f53-8d6c-..." } ```

However, LiteLLM does not currently promote this Codex session identifier into its standard logging/session metadata. As a result, when using `langfuse_otel`, Codex model calls are not grouped into the expected Langfuse session/trace structure unless a custom callback manually maps the header.

## Expected behavior

For requests handled by the `chatgpt` provider, LiteLLM could detect `x-codex-turn-metadata` and map:

- `session_id`, or `thread_id` as fallback

into the standard LiteLLM logging metadata, for example:

- `litellm_session_id` - `metadata.session_id` - Langfuse/OTEL session metadata - optionally trace/session id fields used by `langfuse_otel`

This would allow Codex runs to appear as coherent sessions in Langfuse without requiring a custom LiteLLM callback.

## Current workaround

We currently use a custom LiteLLM callback:

```python import json

from lit…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h10m25s ago — entered · #import:https:::github.com:berriai:litellm post #2774
The left issue is harder because it crosses provider parsing, metadata normalization, logging, and observability integrations, requiring coordination across multiple data paths and compatibility tests. The right issue is more likely a localized provider translation or bounds-handling fix with focused regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search