Skip to main content
GET
/
v4
/
model-groups
/
{model_group_id}
/
usage-statistics
Python
import os
from datetime import datetime
from scale_gp import SGPClient

client = SGPClient(
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
)
model_usage = client.model_groups.usage_statistics.retrieve(
    model_group_id="model_group_id",
    chunks=0,
    end_date=datetime.fromisoformat("2019-12-27T18:11:19.117"),
    start_date=datetime.fromisoformat("2019-12-27T18:11:19.117"),
)
print(model_usage.data)
{
  "data": [
    {
      "date": "2023-11-07T05:31:56Z",
      "prompt_tokens": 123,
      "response_tokens": 123,
      "summary_tokens": 123
    }
  ],
  "start_date": "2023-11-07T05:31:56Z",
  "end_date": "2023-11-07T05:31:56Z"
}

Authorizations

x-api-key
string
header
required

Path Parameters

model_group_id
string
required

Query Parameters

start_date
string<date-time> | null
required
end_date
string<date-time> | null
required
chunks
integer | null
required

Response

Successful Response

data
DataPoint · object[]
required

The list of data points for the given period

start_date
string<date-time>
required

The start date of the data points. Equal to the first date in the data list

end_date
string<date-time>
required

The end date of the data points. Equal to the last date in the data list