Skip to main content
POST
/
cloud
/
v1
/
cost_report
/
totals
Python
import os
from datetime import datetime
from gcore import Gcore

client = Gcore(
    api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
)
cost_report_aggregated = client.cloud.cost_reports.get_aggregated(
    time_from=datetime.fromisoformat("2023-01-01T00:00:00"),
    time_to=datetime.fromisoformat("2023-02-01T00:00:00"),
)
print(cost_report_aggregated.count)
{
  "count": 1,
  "price_status": "error",
  "results": [
    {
      "billing_feature_name": "AI Infrastructure: bm3-ai-1xlarge-h100-80-8 (2 x Intel Xeon 8480+, 2TB RAM, 8x3.84 TB NVMe, 8x Nvidia H100, IB 3.2 Tbit/s, 2x100Gbit/s Ethernet)  Luxembourg-2 - PAYG",
      "billing_metric_name": "<string>",
      "billing_value": 123,
      "billing_value_unit": "<string>",
      "cost": 1000,
      "currency": "EUR",
      "err": null,
      "flavor": "<string>",
      "region": 123,
      "region_id": 123,
      "type": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Body

application/json
time_from
string<date-time>
required

The start date of the report period (ISO 8601). The report starts from the beginning of this day in UTC.

time_to
string<date-time>
required

The end date of the report period (ISO 8601). The report ends just before the beginning of this day in UTC.

enable_last_day
boolean
default:false

Expenses for the last specified day are taken into account. As the default, False.

projects
integer[]

List of project IDs

regions
integer[]

List of region IDs.

response_format
enum<string>
default:json

Format of the response (csv or json).

Available options:
csv_totals,
json
rounding
boolean
default:true

Round cost values to 5 decimal places. When false, returns full precision.

schema_filter
SchemaFilterSnapshotSerializer · object

Extended filter for field filtering.

  • SchemaFilterSnapshotSerializer
  • SchemaFilterInstanceSerializer
  • SchemaFilterAiClusterSerializer
  • SchemaFilterAiVirtualClusterSerializer
  • SchemaFilterBasicVmSerializer
  • SchemaFilterBaremetalSerializer
  • SchemaFilterVolumeSerializer
  • SchemaFilterFileShareSerializer
  • SchemaFilterImageSerializer
  • SchemaFilterFloatingIpSerializer
  • SchemaFilterEgressTrafficSerializer
  • SchemaFilterLoadBalancerSerializer
  • SchemaFilterExternalIpSerializer
  • SchemaFilterBackupSerializer
  • SchemaFilterLogIndexSerializer
  • SchemaFilterFunctionsSerializer
  • SchemaFilterFunctionsCallsSerializer
  • SchemaFilterFunctionsTrafficSerializer
  • SchemaFilterContainersSerializer
  • SchemaFilterInferenceSerializer
  • SchemaFilterDBAASPostgreSQLVolumeSerializer
  • SchemaFilterDBAASPostgreSQLPublicNetworkSerializer
  • SchemaFilterDBAASPostgreSQLCPUSerializer
  • SchemaFilterDBAASPostgreSQLMemorySerializer
  • SchemaFilterDBAASPostgreSQLPoolerSerializer
Example:
{
"field": "flavor",
"type": "instance",
"values": ["g1-standard-1-2"]
}
tags
TagsFilterSerializer · object

Filter by tags

types
enum<string>[]

List of resource types to be filtered in the report.

Resource types for prebilling report

Available options:
ai_cluster,
ai_virtual_cluster,
backup,
baremetal,
basic_vm,
containers,
dbaas_postgresql_connection_pooler,
dbaas_postgresql_cpu,
dbaas_postgresql_memory,
dbaas_postgresql_public_network,
dbaas_postgresql_volume,
egress_traffic,
external_ip,
file_share,
floatingip,
functions,
functions_calls,
functions_traffic,
image,
inference,
instance,
load_balancer,
log_index,
snapshot,
volume

Response

200 - application/json

OK

count
integer
required

Count of returned totals

Required range: x >= 0
price_status
enum<string>
required

Price status for the UI, type: string

Available options:
error,
hide,
show
results
(TotalAiClusterWithCostSerializer · object | TotalAiVirtualClusterWithCostSerializer · object | TotalBaremetalWithCostSerializer · object | TotalBasicVmWithCostSerializer · object | TotalBackupWithCostSerializer · object | TotalContainerWithCostSerializer · object | TotalEgressTrafficWithCostSerializer · object | TotalExternalIpWithCostSerializer · object | TotalFileShareWithCostSerializer · object | TotalFloatingIpWithCostSerializer · object | TotalFunctionsWithCostSerializer · object | TotalFunctionCallsWithCostSerializer · object | TotalFunctionEgressTrafficWithCostSerializer · object | TotalImagesWithCostSerializer · object | TotalInferenceWithCostSerializer · object | TotalInstanceWithCostSerializer · object | TotalLoadBalancerWithCostSerializer · object | TotalLogIndexWithCostSerializer · object | TotalSnapshotWithCostSerializer · object | TotalVolumeWithCostSerializer · object | TotalDBAASPostgreSQLPoolerWithCostSerializer · object | TotalDBAASPostgreSQLMemoryWithCostSerializer · object | TotalDBAASPostgreSQLPublicNetworkWithCostSerializer · object | TotalDBAASPostgreSQLCPUWithCostSerializer · object | TotalDBAASPostgreSQLVolumeWithCostSerializer · object)[]
required
  • TotalAiClusterWithCostSerializer
  • TotalAiVirtualClusterWithCostSerializer
  • TotalBaremetalWithCostSerializer
  • TotalBasicVmWithCostSerializer
  • TotalBackupWithCostSerializer
  • TotalContainerWithCostSerializer
  • TotalEgressTrafficWithCostSerializer
  • TotalExternalIpWithCostSerializer
  • TotalFileShareWithCostSerializer
  • TotalFloatingIpWithCostSerializer
  • TotalFunctionsWithCostSerializer
  • TotalFunctionCallsWithCostSerializer
  • TotalFunctionEgressTrafficWithCostSerializer
  • TotalImagesWithCostSerializer
  • TotalInferenceWithCostSerializer
  • TotalInstanceWithCostSerializer
  • TotalLoadBalancerWithCostSerializer
  • TotalLogIndexWithCostSerializer
  • TotalSnapshotWithCostSerializer
  • TotalVolumeWithCostSerializer
  • TotalDBAASPostgreSQLPoolerWithCostSerializer
  • TotalDBAASPostgreSQLMemoryWithCostSerializer
  • TotalDBAASPostgreSQLPublicNetworkWithCostSerializer
  • TotalDBAASPostgreSQLCPUWithCostSerializer
  • TotalDBAASPostgreSQLVolumeWithCostSerializer