Skip to content

feat(memory): track Composio API call costs in sync audit #3111

@senamakel

Description

@senamakel

Summary

The sync audit log tracks LLM token usage and cost for summarisation, but does not account for the Composio API call costs incurred during data fetching (Gmail, Slack, GitHub via Composio, Notion, Linear, ClickUp).

Each Composio action execution (e.g. GMAIL_FETCH_EMAILS, SLACK_LIST_CONVERSATIONS, GITHUB_LIST_ISSUES) is a billable API call on the Composio platform. These costs are currently invisible in the audit trail.

What needs to change

  1. Track Composio action call counts per sync — each call to execute_action / the Composio Edge API should be counted.

  2. Surface Composio billing — if the Composio API returns usage/billing metadata, capture it. Otherwise track call counts and estimate based on Composio's per-action pricing.

  3. Include in the audit entry — add fields like composio_actions_called: u32 and composio_cost_usd: f64 (or a generic api_calls counter) to SyncAuditEntry.

  4. Display in the UI — the Sync History panel should show API call costs alongside LLM costs for a complete picture of sync expenses.

Where to hook in

  • Composio sync providers live in src/openhuman/memory_sync/composio/providers/
  • Each provider's sync.rs calls the Composio client which makes HTTP requests
  • The client is at src/openhuman/composio/client.rs
  • Audit log: src/openhuman/memory_sync/sources/audit.rs

Acceptance criteria

  • Each composio sync run records the number of API actions executed
  • Cost estimate (or actual if Composio provides it) appears in the audit log
  • Sync History panel shows combined cost (LLM + API calls)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions