GET /v1/usage
This key's metered usage for the current UTC month.
Server: https://gridforge-engine.fly.dev · Operation ID: usage · TS SDK: client.usage()
Behaviour & Evidence Boundary
The statement for the key that is sent: units used this month, by endpoint and by scope, the monthly quota and units remaining, and (pay-as-you-go keys) the accrued amount in cents. Answers 401 without a key. It is never itself metered.
Call via cURL, TypeScript SDK & Python CLI
curl -sS -X GET "https://gridforge-engine.fly.dev/v1/usage" \
-H "Authorization: Bearer $GRIDFORGE_API_KEY"import { GridForgeClient } from "@timetopower/gridforge-sdk";
const client = new GridForgeClient({ apiKey: process.env.GRIDFORGE_API_KEY });
const result = await client.usage();
console.log(result);gridforge usageRequest Contract & Input Schema
This read endpoint takes no request body and no required query parameters.
Response Schema, Headers & Error Codes
Responses carry X-GridForge-Schema: gridforge/api/1, x-request-id, metering headers (X-GridForge-Units, X-GridForge-Units-Month, X-GridForge-Units-Remaining), rate-limit headers (RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset), and RFC 9745/8594 Deprecation / Sunset headers when applicable. POST calls accept Idempotency-Key up to 150 characters.
{
"type": "object",
"required": [
"account",
"key",
"key_id",
"scope",
"expires",
"month",
"units",
"account_units",
"by_scope",
"calls",
"by_endpoint",
"monthly_quota",
"units_remaining",
"unit_rates",
"durable",
"note",
"ledger_durable",
"schema_version"
],
"properties": {
"schema_version": {
"type": "string",
"description": "The engine's API schema id, added to every JSON object response."
},
"account": {
"type": "string"
},
"key": {
"type": "string",
"description": "The key, masked."
},
"key_id": {
"type": "string"
},
"scope": {
"type": "string",
"description": "trial (free allowance), payg, or a plan scope."
},
"expires": {
"type": [
"string",
"null"
]
},
"month": {
"type": "string"
},
"units": {
"type": "integer",
"description": "Net units used this month in this key's own scope."
},
"account_units": {
"type": "integer"
},
"by_scope": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"calls": {
"type": "integer"
},
"by_endpoint": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
},
"monthly_quota": {
"type": [
"integer",
"null"
]
},
"units_remaining": {
"type": [
"integer",
"null"
]
},
"unit_rates": {
"type": "object",
"additionalProperties": {
"type": "integer"
},
"description": "Units per call by route; a route with weight 0 is free."
},
"durable": {
"type": "boolean"
},
"note": {
"type": "string"
},
"ledger_durable": {
"type": "boolean"
},
"unit_price_cents": {
"type": "integer",
"description": "Pay-as-you-go keys only."
},
"accrued_cents": {
"type": "integer",
"description": "Pay-as-you-go keys only: units used this month times the unit price."
}
},
"additionalProperties": true
}| Status | Condition |
|---|---|
| 400 | the body is not valid JSON or not a JSON object, or the Idempotency-Key is longer than the limit |
| 401 | a metered route was called without a key, or with one the engine does not accept |
| 402 | the key's monthly allowance or cap is spent; the call was refused and not charged. Buy more, do not retry |
| 409 | the requested action conflicts with current readiness or state (for example require_rfq_ready on an architecture that is not yet RFQ-ready) |
| 422 | the input is too thin or invalid, or an Idempotency-Key was reused with a different body; nothing was solved |
| 429 | the per-client request rate limit was exceeded; wait and retry (the limit is rate_limit_per_minute at /v1/version) |
| 503 | paid endpoints are not configured on that deployment, or a charge could not be recorded durably |
Worked Example (examples/intake/reference_hall.json)
SYNTHETIC REFERENCE DATASYNTHETIC REFERENCE DATA — every request and response in this file was generated deterministically by running the real GridForge Python engine against examples/intake/reference_hall.json. Not a measurement of any customer asset.
{
"schema_version": "gridforge/api/1",
"account": "reference-synthetic",
"key": "gfk1.…synthetic",
"key_id": "",
"scope": "client",
"expires": null,
"month": "2026-11",
"units": 35,
"account_units": 35,
"by_scope": {
"client": 35
},
"calls": 13,
"by_endpoint": {
"/v1/bids": 2,
"/v1/compare": 1,
"/v1/deck": 3,
"/v1/diff": 2,
"/v1/portfolio": 1,
"/v1/power/assess": 5,
"/v1/power/deploy/assess": 5,
"/v1/power/deploy/bids": 2,
"/v1/power/deploy/spec": 3,
"/v1/proposal": 2,
"/v1/screen": 1,
"/v1/spec": 3,
"/v1/study": 5
},
"monthly_quota": 1000,
"units_remaining": 965,
"unit_rates": {
"/mcp": 0,
"/v1/bids": 2,
"/v1/calibration": 0,
"/v1/calibration/residuals": 0,
"/v1/compare": 1,
"/v1/deck": 3,
"/v1/diff": 2,
"/v1/estimate": 0,
"/v1/portfolio": 1,
"/v1/power/assess": 5,
"/v1/power/deploy/assess": 5,
"/v1/power/deploy/bids": 2,
"/v1/power/deploy/spec": 3,
"/v1/proposal": 2,
"/v1/qualify": 0,
"/v1/screen": 1,
"/v1/spec": 3,
"/v1/study": 5,
"/v1/tools": 0,
"/v1/usage": 0
},
"durable": false,
"note": "Usage is held in memory on this instance and is not durable. Set GRIDFORGE_USAGE_FILE, backed by a mounted volume, before billing against it.",
"ledger_durable": false
}