Skip to content

[ENHANCEMENT] Send X-Zoo-Session-ID header to LiteLLM proxy for per-conversation request correlation #590

@awschmeder

Description

@awschmeder

Problem

When Zoo Code routes requests through a LiteLLM proxy, there is no way for the proxy operator to correlate individual API calls back to a specific Zoo Code conversation thread. LiteLLM natively recognizes the X-<vendor>-Session-ID request header and uses it to tag log entries and spend-tracking records with a session identifier.

Zoo Code already tracks a per-task UUID (taskId) that is unique to each conversation thread and is passed to every createMessage() call via ApiHandlerCreateMessageMetadata. This value is already forwarded to the Zoo Gateway provider as X-Zoo-Task-ID, and to OpenAI Native / Codex providers as session_id. However, the LiteLLMHandler does not forward it at all.

Expected Behavior

When Zoo Code sends a request to a LiteLLM proxy, the HTTP request should include:

X-Zoo-Session-ID: <taskId UUID>

This allows proxy operators to:

  • Filter logs by conversation thread
  • Track per-session token spend
  • Diagnose cache control issues and request timing
  • Correlate multi-turn conversations in LiteLLMs dashboard

Current Behavior

The LiteLLMHandler sends no session or task identifier in request headers. The taskId available in metadata is silently dropped.

References

Industry Context

This follows the x-<vendor>-session-id convention used by:

  • Claude Code: x-claude-code-session-id
  • GitHub Copilot: x-copilot-session-id

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions