Skip to content

fix(ai): a hosted gateway call is priced at the deployment model that the gateway names, not at the route name #2031

Closed

Description

@dan-petty

Friction

The spend ledger prices a hosted gateway call at the route name that the client asked for, for example devops-chat. genai-prices does not know that name, so the call costs $0 in the ledger. LiteLLM 1.103.0 names the deployment model that served the call in the x-litellm-model-name response header, for example openai/gpt-4o.

Evidence

Found while #1631 was built: its agent read get_custom_headers in the gateway's LiteLLM source. #1631 already reads x-litellm-model-api-base to decide whether a call is local or hosted. #1672 only adds a warning for an unknown model; it does not change which name is priced.

Proposed remedy

  • Read x-litellm-model-name from the gateway reply, and price a hosted call at that model.
  • Keep the route name as a label, so the dashboards still group by what the client asked for.
  • A test with a fake gateway reply that names openai/gpt-4o checks a non-zero cost.

Activity

  1. added
    source/agent
    type/bug
    on Oct 24, 2026
  2. dan-petty commented on Oct 24, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.

  3. added a commit that references this issue on Oct 24, 2026
    1a5e463
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source/agenttype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions