Profitability via MCP
Credyt's Profitability feature connects what you earn to what you spend, at the level where it matters most: individual products, customers, and vendor relationships. The MCP server makes that data directly accessible through your AI assistant, so you can query revenue, costs, and margin without building dashboards or writing queries.
This page covers the profitability tools available through the MCP. For a conceptual overview of how Credyt models costs and calculates margin at the event level, see Profitability.
Available tools
| Tool | What it answers |
|---|---|
get_analysis | Account-wide profitability broken down by product, event type, or cost category over a selected period |
list_customer_stats | All customers ranked by profitability — gross revenue, costs, net revenue, and margin |
get_customer_stats | Lifetime profitability for a single customer |
get_vendor_stats | Aggregated cost breakdown for a vendor, by category |
Analysis
get_analysis is the primary tool for understanding profitability across your business. It serves two related purposes: general business insight - understanding revenue mix, cost distribution, and performance trends - and pricing validation, surfacing whether your pricing structures are well-calibrated and where margin is being created or eroded.
Example prompts:
"What was our net margin last month, broken down by product?"
"Show me which event types are losing money this quarter."
"Compare gross revenue and costs by cost category for the last 30 days, scoped to our LLM API product."
"Which product version has the worst margin this month?"
Primary and secondary category
The primary category sets the lens for the analysis - whether you want to understand performance across products, costs by event type, spend by model tier, or just see aggregate numbers for the period.
This first answer often raises a second question. If a product is underperforming, what's driving it - a specific version, an event type with an unexpectedly high cost, a model tier that's consuming margin? If overall costs are up, which cost category is responsible, and which products is it concentrated in? The secondary category is how you drill into that: within each primary group, results are further broken down by a second dimension, letting you trace an outlier or an unexpected pattern to its source rather than stopping at the top level.
Valid combinations:
| Primary | Valid secondary options |
|---|---|
product | version, event_type, cost_category |
event_type | product, cost_category |
cost_category | product, event_type |
For example, if the top-level view by product shows that your AI Agents product has a low margin, adding a secondary breakdown by event_type will surface which operation types within that product are driving the cost. If costs by cost_category show an expensive model tier, breaking down by product will tell you which products are routing to it and at what volume.
You do not need to specify a secondary category upfront. Starting with the primary view and then drilling down with a follow-up prompt is a natural way to work through the analysis.
Filtering
Two filters let you narrow the scope of the analysis before choosing a primary category.
Product filter - scopes the entire analysis to a single product version. Useful when you want to focus on one product in isolation: understanding its cost structure, comparing its versions, or investigating a margin issue without noise from the rest of the catalogue.
Events filter - controls which events are included:
| Value | What's included |
|---|---|
all | Every event, regardless of billing status (default) |
billed | Only events that generated a fee |
unbilled | Only events with no associated fee |
Filtering to unbilled isolates events that generated costs but no revenue - test traffic, zero-price subscription events, or misconfigured products.
Sorting
You can ask the assistant to sort results by net revenue, gross revenue, costs, net margin, or trend, in either direction. Sorting by net margin ascending, for example, immediately surfaces the least profitable products, event types, or cost categories for the selected period.
Customer profitability
List customer stats
list_customer_stats returns profitability stats for all customers over a selected period, defaulting to the last 30 days. Results include gross revenue, costs, net revenue, and margin per customer, with an aggregate summary across all customers.
Example prompts:
"Which customers are unprofitable this month?"
"Show me the top 10 customers by net revenue for Q1."
"What's our overall margin across all customers this quarter?"
"List customers sorted by margin ascending - I want to see who we're losing money on."
Get customer stats
get_customer_stats returns lifetime profitability for a single customer: gross revenue, costs, net revenue, and margin in USD.
Example prompt:
"What's the lifetime margin for customer cust_abc123?"
Vendor costs
get_vendor_stats returns aggregated cost data for a specific vendor, broken down by cost category - typically the model or infrastructure tier your platform routes to.
Cost categories are only as granular as the metadata your platform submits with usage events. If you include model in event cost metadata, the breakdown will reflect individual model tiers. See Profitability for details on how to structure cost metadata.
Example prompts:
"What did we spend with OpenAI last month, broken down by model?"
"How much did we spend on gpt-4o vs gpt-4o-mini this quarter?"
"Show me the cost breakdown for our Anthropic vendor over the last 90 days."
"Which model tier is driving the most cost from our primary vendor?"
See also
- Profitability - how Credyt models costs, cost attribution, and event-level margin calculation
- MCP Server - full tool list and setup instructions