DocsCloud SDK reference

BEEOS CLOUD / DEVELOPER REFERENCE

Usage

The usage summary.

Overview

The usage domain returns the usage summary of your product.

1 operation · SDK resource: TypeScript cloud.usage · Python cloud.usage · Go cloud.Usage · API overview

Main objects

ServerUsageSummary

FieldTypeRequiredDescription
total_bcstringyesTotal charge in the period, in BC micros (millionths of a BeeOS Credit, BC), as a decimal string. For example 1500000 is 1.5 BC.
total_recordsintegeryesNumber of usage records in the period.
by_categorymap<string, string>yesCharge per category in the period, in BC micros as decimal strings, keyed by category. Categories without usage in the period are absent.
by_appmap<string, string>noCharge per app in BC micros as decimal strings. Server API keys see only their own app, so this field is not returned to them.
category_countsmap<string, integer>yesNumber of usage records per category in the period, keyed by category. Categories without usage in the period are absent.

Every field, and the methods that use this object: appendix.

Typical flow

  1. Call usage.getSummary; its period parameter takes day, week, or month.

Methods

MethodHTTPSummary
usage.getSummaryGET /v1/usage/summaryGet the usage summary

usage.getSummary

GET /v1/usage/summary · Operation ID getUsageSummary

Get the usage summary

SDK methods

LanguageMethodSignature
TypeScriptcloud.usage.getSummarygetSummary(query: Models.GetUsageSummaryQuery): Promise<Models.GetUsageSummaryResponse>
Pythoncloud.usage.get_summarydef get_summary(self, options: GetUsageSummaryOptions | None = None) -> ServerUsageSummary
Gocloud.Usage.GetSummaryfunc (r *UsageResource) GetSummary(ctx context.Context, options GetUsageSummaryOptions) (ServerUsageSummary, error)

Parameters

ParameterInTypeRequiredDescription
periodquerystringnoLength of the reporting window, which ends now: day for the last 24 hours (default), week for the last 7 days or month for the last 30 days. The window moves with the current time and does not follow calendar days. Allowed values: "day", "week", "month".
categoryquerystringnoOnly count usage of this category, one of the keys that appear in by_category. Omit it to count all categories.

Response

200 · application/json · Schema: ServerUsageSummary

FieldTypeRequiredDescription
total_bcstringyesTotal charge in the period, in BC micros (millionths of a BeeOS Credit, BC), as a decimal string. For example 1500000 is 1.5 BC.
total_recordsintegeryesNumber of usage records in the period.
by_categorymap<string, string>yesCharge per category in the period, in BC micros as decimal strings, keyed by category. Categories without usage in the period are absent.
by_appmap<string, string>noCharge per app in BC micros as decimal strings. Server API keys see only their own app, so this field is not returned to them.
category_countsmap<string, integer>yesNumber of usage records per category in the period, keyed by category. Categories without usage in the period are absent.

Errors

StatusSchemaDescription
other (default)ErrorResponseCloud Server error

The error schemas are described in Errors.

Example

import { BeeOSClient } from "@beeos-ai/cloud-sdk";

const cloud = new BeeOSClient({
  baseURL: "https://api.cloud.beeos.ai/v1",
  apiKey: "YOUR_API_KEY", // bsk_ key: backend only
});
const result = await cloud.usage.getSummary({});
console.log(result);