Skip to content

feat(mistral): capture usage service tier - #891

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi/mistral-service-tier-26c2468c
Oct 8, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 2 commits into
mainfrom
abhi/mistral-service-tier-26c2468c

Conversation

@AbhiPrasad

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Oct 8, 2026 •

Copy link
Copy Markdown
Member
  • Log service_tier request options for chat and agents.
  • Record usage.service_tier from Mistral responses as metadata, including streamed responses.
  • Extend the existing VCR test to cover response metadata while remaining compatible with Mistral 1.12.4.

Closes #867

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T16:44:33.451775Z a807faa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a807faa98d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".


service_tier = _get_value(_get_value(response, "usage"), "service_tier")
if service_tier is not None:
metadata["service_tier"] = service_tier

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the requested service tier separately

When a caller sends service_tier="auto", Mistral may report either standard or priority as the tier that actually served the request (Mistral Priority Tier documentation). Both completion finalizers merge response metadata after request metadata, so storing the usage value under the same service_tier key overwrites the requested auto value. Successful traces therefore cannot distinguish the request policy from the selected tier or detect fallback; preserve both values, for example by recording the response as usage_service_tier.

Useful? React with 👍 / 👎.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) changed the title fix(mistral): capture usage service tier feat(mistral): capture usage service tier Oct 8, 2026
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 4669a17 into main Oct 8, 2026
83 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi/mistral-service-tier-26c2468c branch October 8, 2026 17:21
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.

Mistral: record usage.service_tier as metadata

2 participants