Ottieni il costo per dimensione
GET/v1/organizations/analytics/cost
Requires
anthropic-beta: analytics-usage-cost-2026-08-24. How to send beta headersOttieni il costo in USD in un intervallo di date, suddiviso per dimensione.
Restituisce una riga per ogni combinazione delle dimensioni group_by[] richieste (e dell'intervallo temporale, quando time_bucket_width è impostato) che presenta costi nell'intervallo di date, classificata in base alla spesa o ordinata per intervallo temporale; tutte le combinazioni vengono restituite attraverso le pagine. Senza group_by[] e senza time_bucket_width, una singola riga aggrega l'intero intervallo di date. Include tutti i costi, che siano attribuibili o meno a un utente con licenza. Richiede una chiave API con lo scope read:analytics, oppure una chiave API Admin.
Parameters
Returns
Ottieni il costo per dimensione
using System;
using Anthropic.Models.Beta.Organization.Analytics.Cost;
CostListParams parameters = new()
{
StartingAt = DateTimeOffset.Parse("2026-09-01T00:00:00Z")
};
var page = await client.Beta.Organization.Analytics.Cost.List(parameters);
await foreach (var item in page.Paginate())
{
Console.WriteLine(item);
}Response 200
{
"data": [
{
"cost": {
"amount": "41280.000000",
"currency": "USD",
"list_amount": "51600.000000",
"requests": 128
},
"ending_at": "2026-10-01T00:00:00Z",
"group": {
"actor": {
"deleted": false,
"email_address": "user@emaildomain.com",
"name": "Jane Doe",
"type": "user_actor",
"user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu"
},
"actor_type": "user_actor",
"agent_id": "agent_01VHd3EAGJ6PLkP9LM7DDu3f",
"api_key_id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
"claude_tag_category": "dm",
"claude_tag_user_id": "U0123ABCDEF",
"context_window": "0-200k",
"cost_type": "tokens",
"deployment_id": "depl_01JFC6ihzZHtAuyHsaENdJhY",
"environment_id": "env_017oTjuGedHtjhJauVC5xGJD",
"inference_geo": "global",
"model": "claude-opus-5-5",
"product": "chat",
"rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",
"service_tier": "standard",
"session_id": "sesn_0187kPDyNCwibNNvfaPEApCJ",
"slack_channel_id": "C0123ABCDEF",
"speed": "fast",
"token_type": "cache_creation.ephemeral_1h_input_tokens",
"user_profile_id": "uprof_01M33NeYUQK2WV9PpYcsPHLi",
"workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
},
"starting_at": "2026-09-01T00:00:00Z"
}
],
"data_refreshed_at": "2026-10-01T04:02:11Z",
"has_more": true,
"next_page": "next_page"
}Returns Examples
Response 200
{
"data": [
{
"cost": {
"amount": "41280.000000",
"currency": "USD",
"list_amount": "51600.000000",
"requests": 128
},
"ending_at": "2026-10-01T00:00:00Z",
"group": {
"actor": {
"deleted": false,
"email_address": "user@emaildomain.com",
"name": "Jane Doe",
"type": "user_actor",
"user_id": "user_01WxYzAbCdEfGhJkMnPqRsTu"
},
"actor_type": "user_actor",
"agent_id": "agent_01VHd3EAGJ6PLkP9LM7DDu3f",
"api_key_id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
"claude_tag_category": "dm",
"claude_tag_user_id": "U0123ABCDEF",
"context_window": "0-200k",
"cost_type": "tokens",
"deployment_id": "depl_01JFC6ihzZHtAuyHsaENdJhY",
"environment_id": "env_017oTjuGedHtjhJauVC5xGJD",
"inference_geo": "global",
"model": "claude-opus-5-5",
"product": "chat",
"rbac_group_id": "rbac_group_012rppKaSVsmTo6NqRDXQXNF",
"service_tier": "standard",
"session_id": "sesn_0187kPDyNCwibNNvfaPEApCJ",
"slack_channel_id": "C0123ABCDEF",
"speed": "fast",
"token_type": "cache_creation.ephemeral_1h_input_tokens",
"user_profile_id": "uprof_01M33NeYUQK2WV9PpYcsPHLi",
"workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
},
"starting_at": "2026-09-01T00:00:00Z"
}
],
"data_refreshed_at": "2026-10-01T04:02:11Z",
"has_more": true,
"next_page": "next_page"
}