This reference is currently available in English. The Cloud console remains in your selected language.
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: the usage summary.
ServerUsageSummary
| Field | Type | Required | Description |
|---|---|---|---|
total_bc | string | yes | Total 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_records | integer | yes | Number of usage records in the period. |
by_category | map<string, string> | yes | Charge per category in the period, in BC micros as decimal strings, keyed by category. Categories without usage in the period are absent. |
by_app | map<string, string> | no | Charge 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_counts | map<string, integer> | yes | Number 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
- Call
usage.getSummary; itsperiodparameter takesday,week, ormonth.
Methods
| Method | HTTP | Summary |
|---|---|---|
| usage.getSummary | GET /v1/usage/summary | Get the usage summary |
usage.getSummary
GET /v1/usage/summary · Operation ID getUsageSummary
Get the usage summary
SDK methods
| Language | Method | Signature |
|---|---|---|
| TypeScript | cloud.usage.getSummary | getSummary(query: Models.GetUsageSummaryQuery): Promise<Models.GetUsageSummaryResponse> |
| Python | cloud.usage.get_summary | def get_summary(self, options: GetUsageSummaryOptions | None = None) -> ServerUsageSummary |
| Go | cloud.Usage.GetSummary | func (r *UsageResource) GetSummary(ctx context.Context, options GetUsageSummaryOptions) (ServerUsageSummary, error) |
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
period | query | string | no | Length 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". |
category | query | string | no | Only 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
| Field | Type | Required | Description |
|---|---|---|---|
total_bc | string | yes | Total 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_records | integer | yes | Number of usage records in the period. |
by_category | map<string, string> | yes | Charge per category in the period, in BC micros as decimal strings, keyed by category. Categories without usage in the period are absent. |
by_app | map<string, string> | no | Charge 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_counts | map<string, integer> | yes | Number of usage records per category in the period, keyed by category. Categories without usage in the period are absent. |
Errors
| Status | Schema | Description |
|---|---|---|
| other (default) | ErrorResponse | Cloud 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);BeeOS CloudBack to documentation