Skip to content

[Feature] Cost Tracking & API Key Management - Monitor Spending Across All AI Services #75

@vzeman

Description

@vzeman

Summary

Implement secure API key management and comprehensive cost tracking across all integrated AI services (Replicate, ElevenLabs, Anthropic Claude). Visibility into spending is essential for users who rely on pay-per-use APIs.

Requirements

API Key Management

  • Secure storage for: Replicate, ElevenLabs, Anthropic (Claude), OpenAI (optional)
  • API key validation on entry
  • Per-service connection status indicator
  • API key rotation support
  • Keychain integration (macOS Keychain, iOS Keychain)

Cost Tracking

  • Per-generation cost estimate (before generation)
  • Actual cost tracking per generation (from API response)
  • Per-scene cost summary
  • Per-project cost total
  • Daily/weekly/monthly spend dashboard
  • Cost breakdown by service (Replicate, ElevenLabs, Anthropic)
  • Budget alerts: warn when approaching a set limit
  • Export cost report as CSV
  • Token usage tracking for Claude API calls

Acceptance Criteria

  • API keys are stored securely in OS keychain (not plaintext)
  • Connection status shows green/red per service
  • Cost estimates display before each generation attempt
  • Actual costs are recorded and match API billing
  • Budget alert triggers notification when threshold reached
  • CSV export contains all generation events with costs

Tech Notes

  • Use flutter_secure_storage for keychain-backed key storage
  • Never log or persist raw API keys in plaintext
  • Cost data should be queryable by date range and project

Related

Part of the ai-video-editor Flutter application. Cross-cutting concern used by #65 (Video Generation), #66 (Text-to-Image), #67 (Voice Generation), and #68 (Storytelling Agent).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-video-editorAI Video Editor Flutter appfeatureNew feature implementationflutterFlutter/Dart implementationphase-5Phase 5: Collaboration & Advanced

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions