Files
OCR/openspec/changes/archive/2025-12-14-simplify-frontend-add-billing/specs/backend-api/spec.md
egg 858d93155f chore: archive completed proposals
Archive two completed proposals:
- enable-audit-logging: Added audit logging for auth, task, and admin events
- simplify-frontend-add-billing: Removed Export/Settings pages, added translation stats

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 12:50:04 +08:00

900 B

Spec Delta: backend-api

ADDED Requirements

Requirement: Translation Statistics Endpoint

The system SHALL provide a new admin API endpoint for translation usage statistics across all users.

Scenario: Admin requests translation statistics

  • GIVEN the admin is authenticated
  • WHEN GET /api/v2/admin/translation-stats is called
  • THEN the response contains:
    • total_translations: number of translation jobs
    • total_input_tokens: sum of input tokens used
    • total_output_tokens: sum of output tokens used
    • estimated_cost: calculated cost based on token pricing
    • by_language: breakdown of translations by target language
    • recent_translations: list of recent translation activities

Scenario: Non-admin user requests translation statistics

  • GIVEN a regular user is authenticated
  • WHEN GET /api/v2/admin/translation-stats is called
  • THEN the response is 403 Forbidden