---
type: email
from: Kazuhiro Sera <notifications@github.com>
subject: Re: [openai/openai-agents-python] feat: #1831 Add opt-in cost

 tracking for LiteLLM models (PR #1832)
received: 2026-03-06 07:57:27
date_header: Sun, 05 Oct 2025 09:28:38 -0700
priority: normal
status: awaiting_approval
uid: 31955
---

## Email Content

**From:** Kazuhiro Sera <notifications@github.com>
**Subject:** Re: [openai/openai-agents-python] feat: #1831 Add opt-in cost

 tracking for LiteLLM models (PR #1832)
**Date:** Sun, 05 Oct 2025 09:28:38 -0700

### Body (preview)

@seratch commented on this pull request.



Thanks for updating this PR. However, I still think it's not a great idea to rely on `_litellm_cost` even though it's optional.



> @@ -120,6 +120,12 @@ class ModelSettings:

     """Whether to include usage chunk.

     Only available for Chat Completions API."""

 

+    track_cost: bool | None = None



This is only related to LiteLLM use cases. Even if we decided to have this feature, I don't think this property should be here. If we add something like this, we may want to introduce LiteLLMSettings, which has only track_cost so far, and pass it to LiteLLMModel constructor as a new arg.



> @@ -1179,6 +1179,9 @@ async def _run_single_turn_streamed(

             prompt=prompt_config,

         ):

             if isinstance(event, ResponseCompletedEvent):

+                # Extract cost if it was attached by LiteLLM model.

+                cost = getattr(event.response, "_litellm_cost", None)



Sorry, but I still hesitate to rely on LiteLLM's underscored property



-- 

Reply to this email directly or view it on GitHub:

https://github.com/openai/openai-agents-python/pull/1832#pullrequestreview-3302453666

You are receiving this because you are subscribed to this thread.



Message ID: <openai/openai-agents-python/pull/1832/review/3302453666@github.com>

---

## Suggested Actions
- [ ] Reply
- [ ] Archive
- [ ] Escalate
