Attribute model spend to each Tapas user in llm-serving-pack metering

Open
#90 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go, kubernetes

Research direction

Read the Tapas model endpoint that enforces dailyTokensPerUser and the agent token broker, then check nebari-dev/llm-serving-pack#313 for the trusted service identity format. Trace how the Keycloak sub reaches the upstream model call and how OpenMeter and the usage console identify users. Done means each call is attributed to the calling user's sub; the issue does not name a test or specific file.

Written by the indexing model from the issue text.

Description

On an internal demo cluster, Tapas's coding agents reach their model through llm-serving-pack's external endpoint with a single API key in ai.apiKeySecret. llm-serving-pack meters usage in OpenMeter and prices it in dollars, but it attributes every request to the key's creator, so all agent spend lands on one person instead of the user whose agent made the call.

Tapas already knows the user on every call through its model endpoint (it enforces dailyTokensPerUser there), so it is the component that can pass that identity on.

What we need

  • Tapas sends the end user's identity with each upstream model call, in whatever form llm-serving-pack accepts for a trusted service (nebari-dev/llm-serving-pack#313).
  • Or, if we go the token route, Tapas calls the internal endpoint with a token exchanged for the user (the agent token broker may already have most of this).
  • Either way, the user identifier must match what OpenMeter and the usage console use (the Keycloak sub).
Dominant language
Go
Stars
5
Forks
0
Avg merge
21h 13m
Merged PRs (30d)
53

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nebari-dev/tapas

All issues in nebari-dev/tapas

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.