Skip to main content

Tracking Credit Consumption

Updated this week

Understanding how credits are consumed at various levels is key to monitoring usage, optimizing billing, and managing your customer activity. Our API provides all the metadata you need to track usage within your own application or business intelligence (BI) environment.

This guide explains how to implement user-level credit tracking and aggregate consumption across a customer's users or tenants.

Overview

Every stream, transcript, and document created through the API returns metadata that includes credit usage details. By storing and analyzing this data, you can calculate credit consumption for your individual users, tenants, or time periods.

You can track usage at multiple levels by:

  • Storing the unique interaction ID returned by the API

  • Using that ID to tie usage back to your internal user records

  • Saving all related records that include credit consumption responses (streams, transcripts, and documents)

  • Aggregating the creditsConsumed field to calculate total usage

  • Storing and visualizing results in your own reporting or BI system


Step 1: Store the Interaction ID Returned from the API

When you create an interaction, the API response includes a unique interactionId.
Store this value in your database and associate it with the relevant user ID or customerID from your application.

Example response (simplified):

{   "interactionId": "int_abc123",   "assignedUserId": "user_12345",   "createdAt": "2025-10-23T10:15:30Z" }

Best Practice:

  • Use your internal userId or tenantId fields to map interactionId values to users.

  • This mapping allows you to aggregate all downstream credit usage (e.g., transcripts, documents, or facts) associated with each interaction.


Step 2: Retrieve Usage Data

There are three responses in which Corti will provide the credits consumed within an Interaction.

Usage data is returned within the /stream endpoint once an "end" message is sent and the audio buffer has been flushed within the websocket.

Corti will return a response with a data type "usage" and the total credits consumed by the streaming session.

{

"type":"usage",

"credits":0.1

}

You can also retrieve credit consumption data from the response to a POST call that generates a transcript or a document.

  • The create transcript response includes:

    • creditsConsumed: credits used for transcript and audio processing

    • createdAt: timestamp for time-based tracking

  • Each generate document response includes:

    • creditsConsumed: credits used for document creation

    • createdAt: timestamp for time-based tracking

Corti recommends retrieving and storing this data upon entity creation as this information will not be able to be retrieved down-stream.


Step 3: Aggregate and Analyze Usage

Once you have collected all relevant records, aggregate the total creditsConsumed values to calculate:

  • Total usage per interaction

  • Total usage per user (using your internal mapping)

  • Total usage per tenant

  • Usage over a specific time window

Example (simplified):

Interaction ID

User ID

Tenant ID

Date

Credits Consumed

int_abc123

user_12345

tenant_A

2025-10-01

120

int_xyz987

user_67890

tenant_A

2025-10-01

75

int_qwe456

user_98765

tenant_B

2025-10-02

300

Aggregate results to show total usage by user or tenant in your reporting system.


Step 4: Store and Visualize in Your BI Tool

To make this data accessible and useful:

  1. Store all retrieved records (interactionId, userId, tenantId, creditsConsumed, and createdAt) in your own database.

  2. Connect that data to a BI tool or your platform’s native reporting interface.

  3. Use filters and visualizations to track:

    • Credit usage trends over time

    • High-usage users or customers

    • Billing or quota consumption reports

Example Workflow Summary

  1. Create Interactions → Capture and store interactionId with your user and customer mapping

  2. Retrieve Records → Upon ending a websocket stream or upon creation of a transcript or document retrieve Interactions, streaming usage, Transcripts and Documents.

  3. Extract Credits → For streaming, use 'credits' and all other endpoints, use creditsConsumed and createdAt

  4. Aggregate Data → Sum credits by interaction, user, tenant, or date range

  5. Store & Visualize → Save to your database or BI tool for analysis


Have a question for our team?

Click Support in the bottom-left corner of the console to submit a ticket or reach out via email at [email protected] and we'll be happy to assist you.

Did this answer your question?