Skip to content

feat(api): enrich provider.list with usage freshness and recent token signals#18439

Open
LucasSantana-Dev wants to merge 1 commit intoanomalyco:devfrom
LucasSantana-Dev:feature/provider-usage-freshness-signals
Open

feat(api): enrich provider.list with usage freshness and recent token signals#18439
LucasSantana-Dev wants to merge 1 commit intoanomalyco:devfrom
LucasSantana-Dev:feature/provider-usage-freshness-signals

Conversation

@LucasSantana-Dev
Copy link

@LucasSantana-Dev LucasSantana-Dev commented Mar 20, 2026

Issue for this PR

Closes #9281

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This extends provider.list with server-derived usage freshness and recent token signals so clients can render provider usage state without duplicating inference logic.

Added fields per provider:

  • usage.state: fresh | stale | missing
  • usage.observedAt
  • usage.ageMinutes
  • usage.recentInputTokens
  • usage.recentOutputTokens

Why this works: values are computed from recent assistant message usage on the server, so all clients consume one canonical classification path.

How did you verify your code works?

  • cd packages/opencode && bun run typecheck
  • cd packages/opencode && bun test test/provider/usage.test.ts

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 20, 2026
@LucasSantana-Dev LucasSantana-Dev changed the title feat: add provider usage freshness signals to provider list feat(api): enrich provider.list with usage freshness and recent token signals Mar 20, 2026
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 20, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

[FEATURE] Add unified usage tracking via /usage (#9545)

1 participant