Add token usage to OpenAiProviderClientBase

Created on 15 August 2025, 20 days ago

Problem/Motivation

Currently the OpenAiProviderClientBase does not implement the five methods we have for the token usage. Of course this might differ per OpenAI based API, since the metadata is not always consistent.

This means that we should move this to a method in the base that you may extend if its different, that gives in the ChatOutput object and the response and that returns the ChatOutput object potentially modified. I think that's the best solution - pass by reference would work as well.

Proposed resolution

Add a new method called setTokenUsage that takes ChatOutput and response and returns ChatOutput.
In OpenAiProviderClientBase created a default version based on OpenAI, but that also uses null coalescing operator if its not set.

πŸ“Œ Task
Status

Active

Version

1.2

Component

AI Core module

Created by

πŸ‡©πŸ‡ͺGermany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024