Skip to main content

Cost Breakdown

developer
GET/v1/analytics/costs

Returns cost breakdown for API usage in the current billing period. Shows month-to-date spending, projected end-of-month cost based on current consumption rate, cost breakdown by endpoint category, and optimization recommendations. Implements the FinOps "Inform" phase — providing the cost visibility needed for optimization decisions.

What It Does

Calculates costs based on your usage and plan pricing for the current billing period. Computes month-to-date spending from usage log aggregates, projects end-of-month costs using daily burn rate extrapolation, breaks down costs by endpoint category (DNS, domain, security, etc.), and generates cost optimization recommendations based on usage patterns. Recommendations may include: caching opportunities for frequently-queried domains, composite endpoint usage to reduce per-request costs, or tier upgrade suggestions when per-request costs would be lower.

Why It's Useful

The FinOps Framework emphasizes that everyone should have access to timely, accurate cost data to make informed decisions. Month-end projections prevent budget surprises, category breakdown reveals where cost optimization will have the most impact, and recommendations provide actionable next steps. For teams on usage-based pricing, understanding cost drivers is essential for controlling monthly spend.

Use Cases

Finance Manager / IT Manager

Monthly Budget Forecasting

Review current spending and month-end projections during weekly budget reviews. Compare projected costs against budget allocation. If projections exceed budget, drill into category breakdown to identify where costs are concentrated.

Prevent budget overruns with accurate month-end cost projections based on actual consumption patterns.

DevOps Engineer / Performance Engineer

Cost Optimization

Identify the highest-cost endpoint categories and review optimization recommendations. Common optimizations include: implementing client-side caching for frequently-queried domains, batching requests using composite endpoints, and reducing redundant lookups across microservices.

Reduce API costs by 20-40% by implementing targeted optimizations for your highest-cost usage patterns.

IT Manager / Engineering Lead

Plan Tier Evaluation

Compare current per-request cost at your tier against higher-tier pricing. When monthly volume exceeds your tier's sweet spot, upgrading can reduce per-request costs. Use projected monthly volume as the basis for tier comparison.

Choose the most cost-effective plan tier based on actual usage data rather than projected estimates.

Parameters

NameTypeRequiredDescription

Response Fields

FieldTypeDescription
current_spendnumberMonth-to-date spending in cents
projected_spendnumberProjected month-end cost based on daily burn rate
by_categoryobjectCost breakdown by endpoint category (dns, domain, security, etc.)
daily_ratenumberAverage daily spending in cents
recommendationsarrayCost optimization suggestions with estimated savings

Code Examples

cURL
curl "https://api.edgedns.dev/v1/analytics/costs" \
  -H "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  'https://api.edgedns.dev/v1/analytics/costs',
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  }
);

const data = await response.json();
console.log(data);
Python
import requests

response = requests.get(
    'https://api.edgedns.dev/v1/analytics/costs',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    params={

    }
)

data = response.json()
print(data)

Read the full Cost Breakdown guide

Why it matters, real-world use cases, parameters, response fields, and how to call it from Claude, ChatGPT, or Gemini via MCP.

Read the guide →

Related Endpoints

External References

Learn more about the standards and protocols behind this endpoint.

Try This Endpoint

Test the Cost Breakdown endpoint live in the playground.