Menu

Claude Code 2.1.317 Gateway Cost Reports: How Organizations Can Now Track Spend by Developer and IdP Group

Managing AI development costs at scale has been one of the hardest operational challenges for enterprises adopting Claude Code and Claude Desktop across their engineering teams. Without centralized visibility into who is spending what, finance teams rely on aggregated billing statements that offer little granularity, and engineering managers struggle to attribute costs to specific projects or individuals. With the release of Claude Code 2.1.317 on November 3, 2026, Anthropic introduced a cost report endpoint on the Claude apps gateway admin API that changes this equation. Organizations can now programmatically retrieve past spend over a date range, broken down in total, per developer, per day, or per identity provider (IdP) group.

What the Claude Apps Gateway Cost Report Endpoint Delivers

The new cost report lives at GET /v1/organizations/analytics/cost and is accessible through the gateway's admin API. It accepts a date range and returns historical spend data with grouping options that were previously unavailable without custom tooling. The endpoint supports four aggregation dimensions: total spend across the entire organization, spend per individual developer, daily spend breakdowns, and spend grouped by IdP group—the organizational units defined in your identity provider, such as engineering teams, departments, or contractor groups.

This granularity matters because most enterprises do not operate as a single homogeneous user base. A machine learning research team running extensive experiments on Claude Opus will generate costs that look very different from a front-end team using Claude Code for routine refactoring tasks. Until now, distinguishing between these usage patterns required parsing raw telemetry data or building internal dashboards from scratch. The gateway cost report collapses that effort into a single API call.

The endpoint is scoped to organizations using the Claude apps gateway—Anthropic's self-hosted control plane that centralizes identity, policy, telemetry, routing, and spend management for Claude Code and Claude Desktop deployments. Organizations using the standard Claude Platform without the gateway should continue using the existing Usage and Cost Admin API at /v1/organizations/usage_report/messages, which provides token-level usage data but does not offer the gateway-specific IdP group dimension.

Why IdP Group-Level Cost Visibility Changes the Game

One of the most significant capabilities in this release is the ability to group costs by IdP group. The gateway now keeps a daily record of each developer's IdP group memberships for the duration configured in admin.identityretentiondays. This daily snapshot means that even if a developer changes teams mid-month, the cost report accurately attributes spend to the group they belonged to on each day of usage.

In practice, this enables several workflows that were previously manual or impossible. A department head can pull a report showing exactly how much their team spent on Claude API usage last quarter without needing to cross-reference HR records with usage logs. Finance teams can generate chargeback reports that assign costs to the correct cost center based on IdP group membership at the time of usage. Platform engineering teams can set up automated alerts when a particular IdP group's daily spend exceeds a threshold, catching misconfigured automation or runaway agent loops before they generate a surprise at month-end.

The daily record also provides an audit trail for compliance purposes. Organizations subject to internal or external audits on AI tool usage can demonstrate exactly which individuals in which teams incurred which costs on which days, with the data sourced directly from the gateway rather than reconstructed from multiple systems.

How the Cost Report Fits into the Broader Gateway Architecture

Understanding the cost report's role requires a brief look at what the Claude apps gateway does as a whole. Deployed as a stateless container within an organization's own infrastructure, the gateway acts as an intermediary between developers' Claude Code or Claude Desktop clients and the upstream inference provider—whether that's Amazon Bedrock, Claude Platform on AWS, or another configuration. It handles five core responsibilities: identity management through OIDC-based single sign-on, centralized policy enforcement, OpenTelemetry-based telemetry export, request routing with optional failover, and spend cap enforcement.

The cost report sits at the intersection of several of these responsibilities. It draws on the same identity layer that authenticates every developer request, which is why it can attribute spend to specific users and IdP groups. It complements the spend cap system: while spend caps prevent costs from exceeding defined limits in real time, the cost report provides the historical analysis that helps organizations tune those caps intelligently. A team that consistently hits its weekly cap might need an increased budget, or it might have an inefficient prompt structure that warrants investigation—the cost report provides the data to make that distinction.

The gateway's telemetry infrastructure also received updates in version 2.1.317. New OpenTelemetry attributes—anthropic.plan, anthropic.seattype, anthropic.provider, and anthropic.custombase_url—are now available on metrics, events, and spans. For organizations that export gateway telemetry to platforms like Datadog, Grafana Cloud, or Honeycomb, these additional attributes allow cost data to be correlated with operational metrics, creating a unified view of both performance and spend.

Practical Steps for Accessing the Cost Report

Accessing the cost report endpoint requires admin-level credentials on the gateway. The endpoint follows the same authentication pattern as other gateway admin endpoints: an Admin API key, an OAuth token with the appropriate scope, or a personal or service account key that is not scoped to a single workspace. Workspace-scoped API keys are not sufficient for this endpoint.

A typical request to retrieve per-developer costs for a given week would specify the date range and the desired grouping dimension. For organizations with a large number of developers, it is advisable to use reasonable date ranges—querying a full year of daily per-developer data in a single call may result in large response payloads. Breaking queries into weekly or monthly chunks and aggregating client-side is a practical approach for long-term trend analysis.

Organizations that have not yet deployed the gateway should note that the cost report endpoint is exclusive to gateway deployments. The standard Claude Platform Usage and Cost Admin API remains available for non-gateway setups and provides token-level usage data with grouping by model, workspace, and API key, but it does not surface the IdP group dimension that the gateway enables.

What Else Arrived in Claude Code 2.1.317

Beyond the gateway cost report, version 2.1.317 shipped over 80 changes, with bug fixes making up more than half of the release. Several security and reliability improvements stand out. A new account email check now prompts before any web or shell tool call transmits the user's account email address to the network, closing a potential information leak vector. Agent SDK hook callbacks gained an onFailure: "block" option, meaning a failed callback can now prevent the associated action from executing—a shift in the default failure behavior that makes guardrails more reliable.

On the session management front, claude -p invocations run inside a cloud or self-hosted runner session no longer share that session's ID and transcript by default. The CLAUDECODEDISABLENESTEDSESSIONID variable can be set to restore the previous behavior for workflows that depend on it. OpenTelemetry exports now time out after 10 seconds by default, configurable up to 30 seconds via OTELEXPORTEROTLPTIMEOUT, preventing stalled telemetry connections from blocking the gateway.

These changes collectively reinforce the gateway's positioning as a production-grade control plane. Each release adds guardrails that make it harder for misconfiguration or unexpected behavior to go unnoticed, which is exactly what enterprises need when rolling out AI coding tools to hundreds or thousands of developers.

What This Means for Organizations Adopting Claude at Scale

The introduction of the gateway cost report signals a maturation in how Anthropic is approaching enterprise governance. Early enterprise AI adoption focused primarily on getting models into developers' hands efficiently. The conversation has since shifted toward control, visibility, and cost management—the same operational concerns that apply to any significant infrastructure investment. The cost report, combined with the existing spend cap system and the gateway's telemetry export capabilities, gives platform teams the data and the levers to manage Claude usage as a managed service rather than a collection of individual API keys.

For organizations currently evaluating whether to deploy the Claude apps gateway, the cost report adds a concrete operational benefit to the decision calculus. The gateway already offered identity consolidation, policy enforcement, and spend caps. With cost reporting now available at the IdP group level, the gateway also becomes the authoritative source for AI tool cost attribution—a capability that tends to become essential once monthly spend crosses into five-figure territory and finance teams begin asking pointed questions about ROI.

The daily IdP group record, in particular, addresses a pain point that any organization with dynamic team structures will recognize. Developers move between teams, contractors come and go, and organizational charts evolve. By snapshotting group membership daily, the gateway ensures that cost attribution stays accurate even as the underlying identity data changes, removing a common source of friction between engineering and finance.

Frequently Asked Questions

Can I use the gateway cost report if my organization does not use the Claude apps gateway?

No. The GET /v1/organizations/analytics/cost endpoint is exclusive to gateway deployments. Organizations using the standard Claude Platform can access usage data through the Usage and Cost Admin API at /v1/organizations/usage_report/messages, which provides token-level breakdowns by model, workspace, and API key but does not include IdP group grouping.

What authentication is required to access the cost report endpoint?

The endpoint requires admin-level credentials. You can authenticate using an Admin API key, an OAuth token with the org:admin scope, or a personal or service account key that is not scoped to a single workspace. Workspace-scoped API keys are not sufficient for this endpoint.

How does the daily IdP group record work?

When the gateway has admin.identityretentiondays configured, it keeps a daily snapshot of each developer's IdP group memberships. The cost report uses these snapshots to attribute spend to the correct IdP group for each day, ensuring accurate cost attribution even when developers change teams over time. For exact configuration parameters, refer to the official Anthropic gateway documentation.

Does this replace the existing Usage and Cost Admin API?

No. The gateway cost report is an additional capability specific to gateway deployments. The existing Usage and Cost Admin API continues to serve organizations that use the Claude Platform without the gateway, and the two APIs serve complementary purposes. Gateway deployments can use the cost report for IdP-group-level attribution and the Usage API for detailed token-level analysis.