---
title: "Provider calls metrics"
method: POST
path: "/api/provider-calls/metrics"
tags: ["provider_calls"]
---

# Provider calls metrics

`POST /api/provider-calls/metrics`

## Request

- Base URL: `https://beta.getsales.io/integrations/v1`
- URL: `https://beta.getsales.io/integrations/v1/api/provider-calls/metrics`
- Auth: HTTP bearer and API key in header `Team-SID`

Period-bound spend, latency and reliability over the calls: credits_charged_sum (what did we spend on AI and enrichment this month), total_tokens_sum, avg_duration_ms, error_rate and cache_hit_rate. period {from, to} is required and capped at 90 days; filter is the search filter; group_by splits by operation, provider, model (the LLM spend axis), status, error_code, source_service, cache_hit or created_date (spend by day). Run budgets and receipts are playtables' credit ledger, not this meter.

Contract:
- MCP tool `get_provider_calls_metrics`, registry package `mcp.integrations/provider_calls`, mount `integrations.providers`.
- Operation `metrics`, response envelope `metrics`.
- Flags: read only.

## Request body

- GetProviderCallsMetricsRequest: Request body of `get_provider_calls_metrics`.
  - `filter` object: Scopes the rows the metrics are computed over: the search filter operators. Omit for all rows.
    - `sid` object: Call sid(s).
      - `eq` string
      - `in` string[]
    - `operation` object: llm.generate, email.find, http.request, crm.*...
      - `eq` 'llm.generate' | 'llm.embed' | 'email.find' | 'email.verify' | 'http.request' | 'crm.contact_upsert' | 'crm.company_upsert' | 'crm.associate' | 'crm.properties_list' | 'serp.search' | 'audio.transcribe'
      - `in` string[]
    - `provider` object: The adapter.
      - `eq` 'openai' | 'anthropic' | 'google' | 'deepseek' | 'xai' | 'voyage' | 'cohere' | 'hunter' | 'findymail' | 'anymailfinder' | 'emaillistverify' | 'custom' | 'hubspot' | 'serper'
      - `in` string[]
    - `model` object: The model of llm and audio calls.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `provider_connection_sid` object: Calls through one connection (is this key working); is_null true = platform-key calls.
      - `eq` string
      - `in` string[]
      - `is_null` boolean
    - `custom_tool_sid` object: One custom tool's calls.
      - `eq` string
      - `in` string[]
    - `source_service` object: playtables | unibox | agents | api | app.
      - `eq` string
      - `in` string[]
    - `tool_type` object: playtable_field, workflow_task, agent_run, custom_tool, dictation.
      - `eq` string
      - `in` string[]
    - `tool_sid` object: One cell's or one run's attempts (with object_sid: one cell).
      - `eq` string
      - `in` string[]
    - `object_sid` object: What was called about one person or company.
      - `eq` string
      - `in` string[]
    - `status` object: success | failed | pending.
      - `eq` 'pending' | 'in_progress' | 'success' | 'failed' | 'retrying' | 'cancelled'
      - `ne` 'pending' | 'in_progress' | 'success' | 'failed' | 'retrying' | 'cancelled'
      - `in` string[]
    - `error_code` object: auth_error is the evidence behind a failed connection.
      - `eq` 'auth_error' | 'rate_limited' | 'timeout' | 'network_error' | 'invalid_input' | 'provider_error' | 'not_found'
      - `in` string[]
      - `is_null` boolean
    - `cache_hit` object: true = served from the cache.
      - `eq` boolean
    - `idempotency_key` object: The call behind one exact charge.
      - `eq` string
    - `credits_charged` object: gt 0 = the paid subset.
      - `eq` number
      - `gte` number
      - `lte` number
      - `gt` number
      - `lt` number
    - `created_at` object: ISO 8601 bounds; a lower bound makes the scan bounded.
      - `gte` string
      - `lte` string
      - `gt` string
      - `lt` string
  - `period` object, required: Required metrics window.
    - `from` string, required: ISO 8601 UTC window start (inclusive).
    - `to` string, required: ISO 8601 UTC window end; at most 90 days after from.
  - `group_by` 'operation' | 'provider' | 'model' | 'status' | 'error_code' | 'source_service' | 'cache_hit' | 'created_date', nullable: One split axis; omit for one total.

## Response `200`

`metrics` success envelope.

- GetProviderCallsMetricsResponse
  - `success` true, required
  - `operation` 'metrics', required
  - `metrics` object, required
    - `filter` object
    - `period` object
      - `from` string, required
      - `to` string, required
    - `aggregated` object
      - `counts` object
      - `metrics` object
        - `credits_charged_sum` number, required: The spend of the window in credits.
        - `total_tokens_sum` number, nullable, required: LLM token volume; null when no llm rows are in scope.
        - `avg_duration_ms` number, nullable, required: Mean over rows with a duration.
        - `error_rate` number, required: failed over total, 0..1.
        - `cache_hit_rate` number, required: cache hits over the rows of cacheable operations, 0..1.
    - `metrics` object
      - `credits_charged_sum` number, required: The spend of the window in credits.
      - `total_tokens_sum` number, nullable, required: LLM token volume; null when no llm rows are in scope.
      - `avg_duration_ms` number, nullable, required: Mean over rows with a duration.
      - `error_rate` number, required: failed over total, 0..1.
      - `cache_hit_rate` number, required: cache hits over the rows of cacheable operations, 0..1.
  - `applied_filters` object
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-integrations.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-integrations/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-integrations/revisions/2e7105d58335?raw)
