Skip to content

Comments

Add feature column to microdollar usage API responses#363

Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
feature/add-feature-to-usage-api
Open

Add feature column to microdollar usage API responses#363
kiloconnect[bot] wants to merge 1 commit intomainfrom
feature/add-feature-to-usage-api

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 19, 2026

Summary

This PR adds the column to the microdollar usage API responses for organization-level usage endpoints. The feature data is already present in the database schema (via the table linked through ), so this change simply exposes it in the API.

Changes Made

  1. Organization Usage Timeseries Endpoint ():

    • Added field to the output schema
    • Added JOIN with and tables
    • Added to the groupBy and output mapping
  2. Organization Usage Details Endpoint (Daily) ():

    • Added field to the response schema
    • Added JOIN with and tables
    • Added to the groupBy and output mapping
  3. TypeScript Types ():

    • Added to the type

Notes

  • The user-level usage API () only returns aggregated metrics, not individual usage rows, so no changes were needed there.
  • The changes are minimal and follow the existing pattern used for the field.
  • The typecheck passes successfully.

Built for Brendan by Kilo for Slack

- Added feature information to organization usage timeseries endpoint
- Added feature information to organization usage details endpoint (daily)
- Added feature to UsageDetailByDay TypeScript type
- Joined with microdollar_usage_metadata and feature tables to expose feature data
kilocode_users.google_user_email,
...(groupByModel ? [microdollar_usage.model] : [])
...(groupByModel ? [microdollar_usage.model] : []),
feature.feature
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[WARNING]: Unconditional feature.feature in GROUP BY is a behavioral change

feature.feature is always included in the GROUP BY here, unlike model which is conditional on groupByModel. This means the get endpoint will now return more granular rows — previously one row per date/user (or date/user/model), now split further by feature. Existing consumers that aggregate or display these results may see unexpected changes (e.g., multiple rows where there used to be one).

Consider either:

  1. Making this conditional via a groupByFeature input flag (consistent with groupByModel), or
  2. Confirming that all consumers of this endpoint are prepared for the increased row count.

@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 19, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/routers/organizations/organization-usage-details-router.ts 348 Unconditional feature.feature in GROUP BY is a behavioral change — the get endpoint will now return more rows (split by feature) which may break existing consumers. Consider making it conditional like groupByModel.
Files Reviewed (2 files)
  • src/lib/organizations/organization-types.ts - 0 issues
  • src/routers/organizations/organization-usage-details-router.ts - 1 issue

Fix these issues in Kilo Cloud

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.

0 participants