Skip to content

Feature Request: API Endpoints for Programmatic Access to Cost and Usage Data #276

@jonopryor

Description

@jonopryor

Feature Request: API Endpoints for Programmatic Access to Cost and Usage Data

Summary

Request for API endpoints that allow programmatic access to cost and usage data for workspaces and API tokens, similar to what's currently available in the Anthropic Console web interface.

Current Situation

The Anthropic Console provides excellent cost and usage reporting through its web interface, including:

  • Detailed cost breakdowns by workspace
  • Usage tracking by API token
  • Spend limits and rate limit monitoring
  • Historical usage data

However, there are currently no documented API endpoints that allow programmatic access to this same cost and usage information.

Requested Feature

API endpoints that would allow developers to:

Cost & Billing Data

  • Retrieve current and historical cost data for workspaces
  • Get cost breakdowns by API token
  • Access spending summaries (daily/monthly/custom date ranges)
  • Monitor spend against configured limits

Usage Data

  • Retrieve token usage statistics by workspace
  • Get request counts and rate limit status
  • Access historical usage trends
  • Monitor usage by API key/token

Workspace Management

  • List workspaces and their associated cost data
  • Get workspace-specific usage metrics
  • Access workspace spend limit configurations

Use Cases

This feature would enable:

  • Automated Cost Monitoring: Build internal dashboards and alerting systems
  • Budget Management: Programmatically track spending against budgets
  • Usage Analytics: Create custom reporting and analytics tools
  • Integration with Internal Systems: Connect Anthropic usage data with existing billing/monitoring systems
  • Multi-tenant Applications: Track usage and costs per customer/tenant

Proposed API Structure

GET /v1/usage/workspaces
GET /v1/usage/workspaces/{workspace_id}/costs
GET /v1/usage/workspaces/{workspace_id}/usage
GET /v1/usage/tokens/{token_id}/costs
GET /v1/usage/tokens/{token_id}/usage
GET /v1/billing/summary

Business Impact

This would significantly improve the developer experience for:

  • Enterprise customers managing multiple workspaces
  • SaaS applications built on Anthropic's API
  • Organizations requiring detailed cost tracking and reporting
  • Teams building internal monitoring and alerting systems

Additional Context

Many other API providers (AWS, Google Cloud, OpenAI) offer programmatic access to billing and usage data, making this a standard expectation for enterprise API consumers.

The Admin API mentioned in the documentation suggests there may already be some programmatic workspace management capabilities, so extending this to include cost/usage data would be a natural evolution.

Priority

High - This is a common enterprise requirement for API cost management and monitoring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions