From 48780c9e839633475ba821fe1db0e09b5d752540 Mon Sep 17 00:00:00 2001 From: Game_Time <108236317+RayBytes@users.noreply.github.com> Date: Fri, 22 Aug 2025 02:09:31 +0500 Subject: [PATCH] finally make token counting work in apps --- chatmock/routes_openai.py | 2 -- chatmock/upstream.py | 1 - 2 files changed, 3 deletions(-) diff --git a/chatmock/routes_openai.py b/chatmock/routes_openai.py index 83dc4cc..446df69 100644 --- a/chatmock/routes_openai.py +++ b/chatmock/routes_openai.py @@ -87,7 +87,6 @@ def chat_completions() -> Response: tool_choice=tool_choice, parallel_tool_calls=parallel_tool_calls, reasoning_param=reasoning_param, - include_usage=(not is_stream) or include_usage, ) if error_resp is not None: return error_resp @@ -256,7 +255,6 @@ def completions() -> Response: input_items, instructions=BASE_INSTRUCTIONS, reasoning_param=reasoning_param, - include_usage=(not stream_req) or include_usage, ) if error_resp is not None: return error_resp diff --git a/chatmock/upstream.py b/chatmock/upstream.py index 20d5c5e..ccbb882 100644 --- a/chatmock/upstream.py +++ b/chatmock/upstream.py @@ -40,7 +40,6 @@ def start_upstream_request( tool_choice: Any | None = None, parallel_tool_calls: bool = False, reasoning_param: Dict[str, Any] | None = None, - include_usage: bool | None = None, ): access_token, account_id = get_effective_chatgpt_auth() if not access_token or not account_id: