refactor: make user AI budget and spend endpoints consistent by ssncferreira · Pull Request #27611 · coder/coder · GitHub
Skip to content

refactor: make user AI budget and spend endpoints consistent - #27611

Merged
ssncferreira merged 1 commit into
mainfrom
ssncf/refactor-user-spend-limit
Jul 29, 2026
Merged

refactor: make user AI budget and spend endpoints consistent#27611
ssncferreira merged 1 commit into
mainfrom
ssncf/refactor-user-spend-limit

Conversation

@ssncferreira

@ssncferreira ssncferreira commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Makes the user AI cost control endpoints consistent.

Changes

  • Replaces the flat spend_limit_micros and limit_source fields on GET /users/{user}/ai/spend with a nested effective_budget, reusing the type behind group_budget. The flat pair made it possible to encode a limit without a source.
  • Renames AIGroupBudget to AIBudgetLimit, since it also carries user_override limits and is no longer group-specific. The type name is not part of the wire format.
  • Moves /users/{user}/ai/budget to /users/{user}/ai/budget/override. The endpoint only ever managed the per-user override, which the type, the handlers, and the operation IDs all already said; the path was the only place that didn't.

Note

Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ssncferreira ssncferreira changed the title refactor: nest user AI spend limit under effective_budget refactor: make user AI budget and spend endpoints consistent Jul 29, 2026
@ssncferreira
ssncferreira force-pushed the ssncf/refactor-user-spend-limit branch from bc3d981 to cd80e33 Compare July 29, 2026 09:59
@ssncferreira
ssncferreira force-pushed the ssncf/refactor-user-spend-limit branch from cd80e33 to 9c53517 Compare July 29, 2026 10:05
@ssncferreira
ssncferreira marked this pull request as ready for review July 29, 2026 10:07
@ssncferreira
ssncferreira requested a review from a team as a code owner July 29, 2026 10:07
@ssncferreira
ssncferreira requested review from EhabY and johnstcn July 29, 2026 10:40

@EhabY EhabY left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@ssncferreira
ssncferreira merged commit d6a5c8e into main Jul 29, 2026
38 checks passed
@ssncferreira
ssncferreira deleted the ssncf/refactor-user-spend-limit branch July 29, 2026 13:01
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 29, 2026
@mtojek

mtojek commented Jul 29, 2026

Copy link
Copy Markdown
Member

Hm... wasn't it API breaking change?

@ssncferreira

Copy link
Copy Markdown
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants