Usage

class Usage(session_kwargs, client, return_type='raw')

Methods

get_llm(id)

Get an individual usage statistic for a given organization

list_llm(*[, org_id, start_date, end_date])

Get a list of usage statistics for a given organization

list_llm_organization_summary(org_id, *[, ...])

Get summarized usage statistics for a given organization

list_matching(*[, org_id, task, start_date, ...])

Get usage statistics for a given organization

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.usage.list_matching(...)
get_llm(id: int)

Get an individual usage statistic for a given organization

Parameters:
idint

The ID of the usage statistic to get.

Returns:
civis.response.Response
  • idint

    The ID of the usage statistic to get.

  • run_idint

    The ID of the run which contributed this usage.

  • job_idint

    The ID of the job which contributed this usage.

  • user_idint

    The ID of the user who started the run.

  • organization_idint

    The organization of the user who started the run.

  • run_created_atstr (date-time)

    When the run was created at.

  • run_timeint

    The duration of the run in seconds.

  • creditsfloat (float)

    The number of credits used.

  • input_tokensint

    The number of tokens input to the run.

  • output_tokensint

    The number of tokens output from the run.

  • model_idstr

    The ID of the LLM model used.

list_llm(*, org_id: int = None, start_date: str = None, end_date: str = None)

Get a list of usage statistics for a given organization

Parameters:
org_idint, optional

The ID of the organization to get usage statistics for.

start_datestr, optional

The start date of the range to get usage statistics for.”“Defaults to the start of the current month if neither start_date nor end_date is specified.

end_datestr, optional

The end date of the range to get usage statistics for.”“Defaults to the end of the current day if neither start_date nor end_date is specified.

Returns:
civis.response.Response
  • idint

    The ID of the usage statistic to get.

  • run_idint

    The ID of the run which contributed this usage.

  • job_idint

    The ID of the job which contributed this usage.

  • user_idint

    The ID of the user who started the run.

  • organization_idint

    The organization of the user who started the run.

  • run_created_atstr (date-time)

    When the run was created at.

  • run_timeint

    The duration of the run in seconds.

  • creditsfloat (float)

    The number of credits used.

  • input_tokensint

    The number of tokens input to the run.

  • output_tokensint

    The number of tokens output from the run.

  • model_idstr

    The ID of the LLM model used.

list_llm_organization_summary(org_id: int, *, start_date: str = None, end_date: str = None)

Get summarized usage statistics for a given organization

Parameters:
org_idint

The ID of the organization to get usage statistics for.

start_datestr, optional

The start date of the range to get usage statistics for.”“Defaults to the start of the current month if neither start_date nor end_date is specified.

end_datestr, optional

The end date of the range to get usage statistics for.”“Defaults to the end of the current day if neither start_date nor end_date is specified.

Returns:
civis.response.Response
  • creditsfloat (float)

    The number of credits used.

  • organization_idint

    The organization for which LLM usage statistics are summarized.

list_matching(*, org_id: int = None, task: str = None, start_date: str = None, end_date: str = None)

Get usage statistics for a given organization

Parameters:
org_idint, optional

The ID of the organization to get usage statistics for.

taskstr, optional

The type of matching job contributing to this usage. One of [“IDR”, “CDM”].

start_datestr, optional

The start date of the range to get usage statistics for.

end_datestr, optional

The end date of the range to get usage statistics for.

Returns:
civis.response.Response
  • run_idint

    The ID of the run which contributed this usage.

  • job_idint

    The ID of the job which contributed this usage.

  • user_idint

    The ID of the user who started the run.

  • organization_idint

    The organization of the user who started the run.

  • run_created_atstr (date-time)

    When the run was created at.

  • run_timeint

    The duration of the run in seconds.

  • num_recordsint

    The number of records matched by the run.

  • taskstr

    The type of matching job contributing to this usage. One of [“IDR”, “CDM”].