Skip to content

feat(server-ai): stamp modelKey and modelVersion on AI usage events (AIC-2851)#208

Open
atornsii wants to merge 2 commits into
mainfrom
atornsii/AIC-2851/add-support-for-model-key-version
Open

feat(server-ai): stamp modelKey and modelVersion on AI usage events (AIC-2851)#208
atornsii wants to merge 2 commits into
mainfrom
atornsii/AIC-2851/add-support-for-model-key-version

Conversation

@atornsii

@atornsii atornsii commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • Read modelKey and modelVersion from the AI Config variation payload (variation['model']) and expose them on ModelConfig
  • Stamp modelKey (when present) and modelVersion on all LDAIConfigTracker metric event payloads, alongside existing modelName/providerName fields
  • Default modelVersion to 1 when absent, matching variation version handling; exclude both fields from the resumption token
  • Additive/backward compatible — older payloads without the new fields continue to work

Part of AIC-2851 / AIC-2849. Depends on backend payload work (AIC-2876) shipping modelKey/modelVersion on variations.

Test plan

  • uv run pytest in packages/sdk/server-ai (229 passed)
  • uv run mypy src/ldai
  • uv run isort --check --atomic src/ldai
  • uv run pycodestyle src/ldai
  • Verify against a staging environment once AIC-2876 payload is available

Made with Cursor

Read pinned model key/version from the AI Config variation payload and include them on tracker metric events to support version-aware cost attribution.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jsonbailey

Copy link
Copy Markdown
Contributor

Holding based on our conversation today and we will follow up on slack before reviewing.

@atornsii atornsii marked this pull request as ready for review July 9, 2026 20:32
@atornsii atornsii requested a review from a team as a code owner July 9, 2026 20:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a04361b. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/client.py Outdated
Older variations are not backfilled with modelVersion, so defaulting to 1 mis-stamped events. Only include the field when the payload provides it and let the backend apply its version-1 fallback on read.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants