Skip to content

Add metadata cost breakdown to Request Analytics API spec#325

Merged
bb220 merged 1 commit into
masterfrom
claude/eloquent-mendel-uS4xT
Jun 1, 2026
Merged

Add metadata cost breakdown to Request Analytics API spec#325
bb220 merged 1 commit into
masterfrom
claude/eloquent-mendel-uS4xT

Conversation

@bb220
Copy link
Copy Markdown
Collaborator

@bb220 bb220 commented May 29, 2026

Summary

  • Adds metadata_cost_breakdown_key to the RequestLogQuery request schema. When provided, the analytics response includes a metadataValueBreakdown array scoped to that metadata key's values.
  • Adds metadataValueBreakdown to the RequestAnalyticsResponse schema. Each entry contains key, value, label, requests, and cost. When a specific key is requested the label equals the value; in the aggregate view the label is key = value. Results are ordered by cost descending, up to 50 entries.

Generated by Claude Code

…cs API spec

Adds two new fields to the Request Analytics endpoint:

- `metadata_cost_breakdown_key` (request field on RequestLogQuery): when
  provided, the response includes a cost/request breakdown filtered to that
  specific metadata key.
- `metadataValueBreakdown` (response field on RequestAnalyticsResponse):
  array of key/value/label/requests/cost entries, ordered by cost descending,
  up to 50 entries.

https://claude.ai/code/session_01DJAvfB8L7GLPpAyNU6r9yz
@bb220 bb220 added the automation label May 29, 2026 — with Claude
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 29, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
promptlayer 🟢 Ready View Preview May 29, 2026, 9:12 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: f221dc15d2

ℹ️ 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 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 address that feedback".

Comment thread openapi.json
Comment on lines +16208 to +16211
"metadata_cost_breakdown_key": {
"type": "string",
"nullable": true,
"description": "When provided, the analytics response includes a `metadataValueBreakdown` array with cost and request counts for each value of this metadata key. Omit or pass null to get an aggregate breakdown across the top metadata keys."
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 Keep analytics-only fields out of search schema

Adding this field to RequestLogQuery also adds it to SearchRequestLogsRequest, because the search request schema is an allOf over #/components/schemas/RequestLogQuery (openapi.json lines 16673-16679). That makes POST /api/public/v2/requests/search advertise an analytics-only option whose description talks about changing the analytics response, which is not the real search API contract and will surface confusing/generated docs for the search endpoint. Please put this parameter on an analytics-specific request schema instead of the shared search/analytics base.

Useful? React with 👍 / 👎.

@bb220 bb220 merged commit d862fb7 into master Jun 1, 2026
4 checks passed
@bb220 bb220 deleted the claude/eloquent-mendel-uS4xT branch June 1, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants