Skip to content

Add cost metrics for all providers

Jan Provaznik requested to merge jp-cost-metrics into master

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/415944

Add cost metrics for all providers

  • measures token size for Antorhopic/Vertex requests/responses
  • prompt/response size divided by estimated token size is used so this measurement may not be very precise, but it should be still useful for overall statistics
  • also stores snowplow events for tokens used for single AI requests and summary of all requests done by the client

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jan Provaznik

Merge request reports