[PIX-7733] fix costs API cost attribution for usage-only agents #45

Merged
andrei merged 1 commit from fix/PIX-7733-cost-attribution into master 2026-06-07 11:00:41 +00:00
Owner

Что сделано

  • восстановлен fallback для /api/companies/:companyId/costs/by-agent и legacy /costs, когда heartbeat usage есть, а price data отсутствует
  • добавлены поля estimatedCostCents, estimatedTotalCostUsd, costStatus, meteredUnpricedRunCount, meteredUnpricedTokens
  • добавлены regression tests и обновлена API документация

Как проверено

  • pnpm exec vitest run server/src/__tests__/costs-service.test.ts --reporter=verbose
  • pnpm --filter @paperclipai/server typecheck в основном checkout
  • live /api/health = 200
  • live /api/companies/$PAPERCLIP_COMPANY_ID/costs/by-agent и /costs теперь возвращают ненулевой costCents
## Что сделано - восстановлен fallback для `/api/companies/:companyId/costs/by-agent` и legacy `/costs`, когда heartbeat usage есть, а price data отсутствует - добавлены поля `estimatedCostCents`, `estimatedTotalCostUsd`, `costStatus`, `meteredUnpricedRunCount`, `meteredUnpricedTokens` - добавлены regression tests и обновлена API документация ## Как проверено - `pnpm exec vitest run server/src/__tests__/costs-service.test.ts --reporter=verbose` - `pnpm --filter @paperclipai/server typecheck` в основном checkout - live `/api/health` = 200 - live `/api/companies/$PAPERCLIP_COMPANY_ID/costs/by-agent` и `/costs` теперь возвращают ненулевой `costCents`
fix: restore cost attribution for usage-only agent spend
All checks were successful
Agents CI / Typecheck and Build (pull_request) Successful in 2m32s
7cd1c6f3b4
andrei merged commit 3fce0aa4bc into master 2026-06-07 11:00:41 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
europa-tech-srl/europa-tech-agents!45
No description provided.