#29978 [Feature]: Map Codex session metadata to LiteLLM/Langfuse session fields
## 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…