http
GET /accounts/{account_id}/usage/creditsBreak the credit spend of an account down by day, project and model, optionally for one project; returns the series with token counts per model. Requires account.billing.read.
Servers
JSON
1[2 {3 "url": "https://api.veryfront.com"4 }5]Authentication
JSON
1[2 {3 "bearerAuth": []4 },5 {6 "apiKeyAuth": []7 }8]JSON
1{2 "bearerAuth": {3 "type": "http",4 "scheme": "bearer",5 "bearerFormat": "JWT or API Key",6 "description": "Use a JWT bearer token or a Veryfront API key in the `Authorization` header."7 },8 "apiKeyAuth": {9 "type": "apiKey",10 "in": "header",11 "name": "X-API-Key",12 "description": "Alternative API key header for `vf_<prefix>_<secret>` tokens."13 }14}Parameters
| Name | Location | Required | Description |
|---|---|---|---|
| account_id | path | Yes | |
| preset | query | No | Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults. |
| from | query | No | Inclusive start. Supply both from and to; these bounds take precedence over preset. |
| to | query | No | Exclusive end, no later than the end of today in timezone. |
| timezone | query | No | |
| granularity | query | No | UTC hours, or local calendar days, Monday-based weeks and months. |
| group_by | query | No | Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list. |
| compare | query | No | Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise. |
| project_reference | query | No | Project ID or slug that narrows the read to one project of the account. A project of another account is not found. |
Parameter contracts
JSON
1[2 {3 "schema": {4 "type": "string",5 "format": "uuid"6 },7 "required": true,8 "name": "account_id",9 "in": "path"10 },11 {12 "schema": {13 "$ref": "#/components/schemas/UsageQueryPreset"14 },15 "required": false,16 "description": "Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults.",17 "name": "preset",18 "in": "query"19 },20 {21 "schema": {22 "$ref": "#/components/schemas/UsageQueryFrom"23 },24 "required": false,25 "description": "Inclusive start. Supply both from and to; these bounds take precedence over preset.",26 "name": "from",27 "in": "query"28 },29 {30 "schema": {31 "$ref": "#/components/schemas/UsageQueryTo"32 },33 "required": false,34 "description": "Exclusive end, no later than the end of today in timezone.",35 "name": "to",36 "in": "query"37 },38 {39 "schema": {40 "$ref": "#/components/schemas/UsageQueryTimezone"41 },42 "required": false,43 "name": "timezone",44 "in": "query"45 },46 {47 "schema": {48 "$ref": "#/components/schemas/UsageQueryGranularity"49 },50 "required": false,51 "description": "UTC hours, or local calendar days, Monday-based weeks and months.",52 "name": "granularity",53 "in": "query"54 },55 {56 "schema": {57 "$ref": "#/components/schemas/UsageQueryGroupBy"58 },59 "required": false,60 "description": "Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list.",61 "name": "group_by",62 "in": "query",63 "style": "form",64 "explode": true65 },66 {67 "schema": {68 "$ref": "#/components/schemas/UsageQueryCompare"69 },70 "required": false,71 "description": "Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise.",72 "name": "compare",73 "in": "query"74 },75 {76 "schema": {77 "type": "string",78 "minLength": 1,79 "description": "Project ID or slug that narrows the read to one project of the account. A project of another account is not found."80 },81 "required": false,82 "description": "Project ID or slug that narrows the read to one project of the account. A project of another account is not found.",83 "name": "project_reference",84 "in": "query"85 }86]Responses
200
Credit usage of the account by day, project and model, optionally for one project.
JSON
1{2 "description": "Credit usage of the account by day, project and model, optionally for one project.",3 "content": {4 "application/json": {5 "schema": {6 "type": "object",7 "properties": {8 "summary": {9 "type": "object",10 "properties": {11 "credits_used": {12 "type": "number",13 "description": "Total credits used."14 },15 "requests": {16 "type": "number",17 "description": "Total AI requests."18 },19 "input_tokens": {20 "type": "number",21 "description": "Total input tokens."22 },23 "output_tokens": {24 "type": "number",25 "description": "Total output tokens."26 },27 "cache_creation_input_tokens": {28 "type": "number",29 "description": "Total cache creation input tokens."30 },31 "cache_read_input_tokens": {32 "type": "number",33 "description": "Total cache read input tokens."34 },35 "previous": {36 "type": "object",37 "properties": {38 "credits_used": {39 "type": "number",40 "description": "Total credits used."41 },42 "requests": {43 "type": "number",44 "description": "Total AI requests."45 },46 "input_tokens": {47 "type": "number",48 "description": "Total input tokens."49 },50 "output_tokens": {51 "type": "number",52 "description": "Total output tokens."53 },54 "cache_creation_input_tokens": {55 "type": "number",56 "description": "Total cache creation input tokens."57 },58 "cache_read_input_tokens": {59 "type": "number",60 "description": "Total cache read input tokens."61 }62 },63 "required": [64 "credits_used",65 "requests",66 "input_tokens",67 "output_tokens",68 "cache_creation_input_tokens",69 "cache_read_input_tokens"70 ]71 }72 },73 "required": [74 "credits_used",75 "requests",76 "input_tokens",77 "output_tokens",78 "cache_creation_input_tokens",79 "cache_read_input_tokens"80 ]81 },82 "timeframe": {83 "type": "object",84 "properties": {85 "from": {86 "type": "string",87 "format": "date-time",88 "description": "Inclusive start."89 },90 "to": {91 "type": "string",92 "format": "date-time",93 "description": "Exclusive end."94 },95 "timezone": {96 "type": "string"97 },98 "granularity": {99 "type": "string",100 "enum": [101 "hour",102 "day",103 "week",104 "month"105 ]106 },107 "bucket_count": {108 "type": "integer",109 "minimum": 0110 },111 "previous": {112 "type": "object",113 "properties": {114 "from": {115 "type": "string",116 "format": "date-time",117 "description": "Inclusive start."118 },119 "to": {120 "type": "string",121 "format": "date-time",122 "description": "Exclusive end."123 },124 "timezone": {125 "type": "string"126 },127 "granularity": {128 "type": "string",129 "enum": [130 "hour",131 "day",132 "week",133 "month"134 ]135 },136 "bucket_count": {137 "type": "integer",138 "minimum": 0139 }140 },141 "required": [142 "from",143 "to",144 "timezone",145 "granularity",146 "bucket_count"147 ]148 }149 },150 "required": [151 "from",152 "to",153 "timezone",154 "granularity",155 "bucket_count"156 ]157 },158 "series": {159 "type": "array",160 "items": {161 "type": "object",162 "properties": {163 "bucket_start": {164 "type": "string",165 "description": "Bucket start timestamp."166 },167 "credits_used": {168 "type": "number",169 "description": "Credits used in the bucket."170 },171 "requests": {172 "type": "number",173 "description": "AI requests in the bucket."174 },175 "input_tokens": {176 "type": "number",177 "description": "Input tokens in the bucket."178 },179 "output_tokens": {180 "type": "number",181 "description": "Output tokens in the bucket."182 },183 "cache_creation_input_tokens": {184 "type": "number",185 "description": "Cache creation input tokens in the bucket."186 },187 "cache_read_input_tokens": {188 "type": "number",189 "description": "Cache read input tokens in the bucket."190 },191 "projects": {192 "type": "array",193 "items": {194 "type": "object",195 "properties": {196 "project_id": {197 "type": [198 "string",199 "null"200 ],201 "format": "uuid",202 "description": "Project ID, or null for unscoped usage."203 },204 "project_name": {205 "type": "string",206 "description": "Project display name."207 },208 "project_slug": {209 "type": [210 "string",211 "null"212 ],213 "description": "Project slug, or null when unavailable."214 },215 "credits_used": {216 "type": "number",217 "description": "Credits used by this project."218 },219 "requests": {220 "type": "number",221 "description": "AI requests billed to this project."222 },223 "input_tokens": {224 "type": "number",225 "description": "Input tokens billed to this project."226 },227 "output_tokens": {228 "type": "number",229 "description": "Output tokens billed to this project."230 },231 "cache_creation_input_tokens": {232 "type": "number",233 "description": "Cache creation input tokens billed to this project."234 },235 "cache_read_input_tokens": {236 "type": "number",237 "description": "Cache read input tokens billed to this project."238 }239 },240 "required": [241 "project_id",242 "project_name",243 "project_slug",244 "credits_used",245 "requests",246 "input_tokens",247 "output_tokens",248 "cache_creation_input_tokens",249 "cache_read_input_tokens"250 ]251 }252 },253 "groups": {254 "type": "array",255 "items": {256 "type": "object",257 "properties": {258 "credits_used": {259 "type": "number",260 "description": "Total credits used."261 },262 "requests": {263 "type": "number",264 "description": "Total AI requests."265 },266 "input_tokens": {267 "type": "number",268 "description": "Total input tokens."269 },270 "output_tokens": {271 "type": "number",272 "description": "Total output tokens."273 },274 "cache_creation_input_tokens": {275 "type": "number",276 "description": "Total cache creation input tokens."277 },278 "cache_read_input_tokens": {279 "type": "number",280 "description": "Total cache read input tokens."281 },282 "dimensions": {283 "type": "object",284 "properties": {285 "project_id": {286 "type": [287 "string",288 "null"289 ],290 "format": "uuid"291 },292 "model": {293 "type": [294 "string",295 "null"296 ]297 },298 "model_provider": {299 "type": [300 "string",301 "null"302 ]303 },304 "api_key_id": {305 "type": [306 "string",307 "null"308 ],309 "format": "uuid"310 },311 "api_key_kind": {312 "type": "string",313 "enum": [314 "api_key",315 "no_api_key",316 "other_keys",317 "deleted_keys",318 "unattributed"319 ],320 "description": "Key-listing reports distinguish named keys, other/deleted keys, keyless and unattributed usage."321 },322 "member_id": {323 "type": [324 "string",325 "null"326 ],327 "format": "uuid"328 },329 "member_kind": {330 "type": "string",331 "enum": [332 "member",333 "former_member",334 "deleted_users",335 "automations",336 "unattributed"337 ],338 "description": "Project-member reports distinguish named people, deleted users, automations and unattributed usage."339 }340 }341 }342 },343 "required": [344 "credits_used",345 "requests",346 "input_tokens",347 "output_tokens",348 "cache_creation_input_tokens",349 "cache_read_input_tokens",350 "dimensions"351 ]352 }353 }354 },355 "required": [356 "bucket_start",357 "credits_used",358 "requests",359 "input_tokens",360 "output_tokens",361 "cache_creation_input_tokens",362 "cache_read_input_tokens",363 "projects"364 ]365 }366 },367 "projects": {368 "type": "array",369 "items": {370 "type": "object",371 "properties": {372 "project_id": {373 "type": [374 "string",375 "null"376 ],377 "format": "uuid",378 "description": "Project ID, or null for unscoped usage."379 },380 "project_name": {381 "type": "string",382 "description": "Project display name."383 },384 "project_slug": {385 "type": [386 "string",387 "null"388 ],389 "description": "Project slug, or null when unavailable."390 },391 "credits_used": {392 "type": "number",393 "description": "Credits used by this project."394 },395 "requests": {396 "type": "number",397 "description": "AI requests billed to this project."398 },399 "input_tokens": {400 "type": "number",401 "description": "Input tokens billed to this project."402 },403 "output_tokens": {404 "type": "number",405 "description": "Output tokens billed to this project."406 },407 "cache_creation_input_tokens": {408 "type": "number",409 "description": "Cache creation input tokens billed to this project."410 },411 "cache_read_input_tokens": {412 "type": "number",413 "description": "Cache read input tokens billed to this project."414 }415 },416 "required": [417 "project_id",418 "project_name",419 "project_slug",420 "credits_used",421 "requests",422 "input_tokens",423 "output_tokens",424 "cache_creation_input_tokens",425 "cache_read_input_tokens"426 ]427 }428 },429 "models": {430 "type": "array",431 "items": {432 "type": "object",433 "properties": {434 "funding": {435 "type": "string",436 "enum": [437 "managed",438 "customer",439 "mixed"440 ],441 "description": "Recorded credential funding; omitted when unknown. Credits always reflect the historical ledger."442 },443 "model": {444 "type": "string",445 "description": "Canonical or normalized AI model identifier."446 },447 "canonical_model_id": {448 "type": "string",449 "description": "Canonical catalog model identifier."450 },451 "model_provider": {452 "type": "string",453 "description": "Model vendor id. Known values: `anthropic`, `openai`, `google`, `mistral`, `moonshotai`, `deepseek`, `qwen`, `zai`, `unknown`. Other vendor ids may appear; clients must accept any string.",454 "example": "anthropic"455 },456 "inference_provider": {457 "type": "string",458 "description": "Inference provider handling the request. Known values: `veryfront-cloud`, `unknown`. Other values may appear; clients must accept any string.",459 "example": "veryfront-cloud"460 },461 "credits_used": {462 "type": "number",463 "description": "Credits used by this model."464 },465 "requests": {466 "type": "number",467 "description": "AI requests billed to this model."468 },469 "input_tokens": {470 "type": "number",471 "description": "Input tokens billed to this model."472 },473 "output_tokens": {474 "type": "number",475 "description": "Output tokens billed to this model."476 },477 "cache_creation_input_tokens": {478 "type": "number",479 "description": "Cache creation input tokens billed to this model."480 },481 "cache_read_input_tokens": {482 "type": "number",483 "description": "Cache read input tokens billed to this model."484 },485 "provider_cost_usd": {486 "type": "number",487 "description": "Model provider cost in USD for this model."488 },489 "veryfront_charge_usd": {490 "type": "number",491 "description": "Veryfront charge in USD for this model."492 },493 "cost_attribution": {494 "type": "string",495 "enum": [496 "estimated"497 ],498 "description": "Present when historical cost attribution was recovered from persisted credits."499 }500 },501 "required": [502 "model",503 "model_provider",504 "inference_provider",505 "credits_used",506 "requests",507 "input_tokens",508 "output_tokens",509 "cache_creation_input_tokens",510 "cache_read_input_tokens"511 ]512 }513 },514 "serving": {515 "type": "array",516 "items": {517 "type": "object",518 "properties": {519 "host": {520 "type": [521 "string",522 "null"523 ],524 "description": "Catalog ID of the deployment host, not a provider hostname or URL. Null means no deployment was recorded, including older usage, calls without a catalog deployment, and aggregated channel usage. Null does not indicate where inference ran."525 },526 "tier": {527 "type": [528 "string",529 "null"530 ],531 "description": "Sovereignty tier as a catalog ID. Clients must accept unknown values as tiers can be added. Null means no tier was recorded and does not indicate where inference ran. The API does not infer a tier from billing or other fields.",532 "example": "eu-resident"533 },534 "funding": {535 "type": "string",536 "enum": [537 "managed",538 "customer",539 "mixed"540 ],541 "description": "Recorded funding for this spend group; omitted when provenance is unknown."542 },543 "credits": {544 "type": "number",545 "description": "Credits debited in the timeframe."546 },547 "usd": {548 "type": "number",549 "description": "Customer-billed USD for those credits."550 },551 "requests": {552 "type": "number",553 "description": "Number of provider calls recorded."554 },555 "input_tokens": {556 "type": "number",557 "description": "Input tokens."558 },559 "output_tokens": {560 "type": "number",561 "description": "Output tokens."562 },563 "cache_read_tokens": {564 "type": "number",565 "description": "Tokens read from the prompt cache."566 },567 "cache_creation_tokens": {568 "type": "number",569 "description": "Tokens written to the prompt cache."570 }571 },572 "required": [573 "host",574 "tier",575 "credits",576 "usd",577 "requests",578 "input_tokens",579 "output_tokens",580 "cache_read_tokens",581 "cache_creation_tokens"582 ]583 },584 "description": "The same spend cut by the deployment that served it. Ordered by spend descending, then by request count descending, then by host, then by tier; the row whose `host` and `tier` are both null is always last, because it is the absence of a record rather than a deployment. Additive: it neither replaces nor re-slices any other field. Omitted where the serving breakdown is not enabled; `models` is unchanged by it."585 },586 "scope": {587 "type": "object",588 "properties": {589 "kind": {590 "type": "string",591 "enum": [592 "account"593 ]594 },595 "account_id": {596 "type": "string",597 "format": "uuid"598 },599 "project_id": {600 "type": [601 "string",602 "null"603 ],604 "format": "uuid"605 }606 },607 "required": [608 "kind",609 "account_id",610 "project_id"611 ]612 },613 "group_by": {614 "type": "array",615 "items": {616 "type": "string",617 "enum": [618 "project",619 "model",620 "api_key",621 "member"622 ]623 }624 }625 },626 "required": [627 "summary",628 "timeframe",629 "series",630 "projects",631 "models"632 ]633 }634 }635 }636}400
Bad request
JSON
1{2 "description": "Bad request",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}401
Unauthorized
JSON
1{2 "description": "Unauthorized",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}403
Forbidden
JSON
1{2 "description": "Forbidden",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}404
Not found
JSON
1{2 "description": "Not found",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}500
Server error
JSON
1{2 "description": "Server error",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}Referenced contracts
components/parameters/UsageQueryPreset
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryPreset"4 },5 "required": false,6 "description": "Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults.",7 "name": "preset",8 "in": "query"9}components/schemas/UsageQueryPreset
JSON
1{2 "type": "string",3 "enum": [4 "7d",5 "30d",6 "90d"7 ],8 "default": "30d",9 "description": "Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults."10}components/parameters/UsageQueryFrom
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryFrom"4 },5 "required": false,6 "description": "Inclusive start. Supply both from and to; these bounds take precedence over preset.",7 "name": "from",8 "in": "query"9}components/schemas/UsageQueryFrom
JSON
1{2 "type": "string",3 "format": "date-time",4 "description": "Inclusive start. Supply both from and to; these bounds take precedence over preset."5}components/parameters/UsageQueryTo
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryTo"4 },5 "required": false,6 "description": "Exclusive end, no later than the end of today in timezone.",7 "name": "to",8 "in": "query"9}components/schemas/UsageQueryTo
JSON
1{2 "type": "string",3 "format": "date-time",4 "description": "Exclusive end, no later than the end of today in timezone."5}components/parameters/UsageQueryTimezone
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryTimezone"4 },5 "required": false,6 "name": "timezone",7 "in": "query"8}components/schemas/UsageQueryTimezone
JSON
1{2 "type": "string",3 "default": "UTC"4}components/parameters/UsageQueryGranularity
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryGranularity"4 },5 "required": false,6 "description": "UTC hours, or local calendar days, Monday-based weeks and months.",7 "name": "granularity",8 "in": "query"9}components/schemas/UsageQueryGranularity
JSON
1{2 "type": "string",3 "enum": [4 "hour",5 "day",6 "week",7 "month"8 ],9 "default": "day",10 "description": "UTC hours, or local calendar days, Monday-based weeks and months."11}components/parameters/UsageQueryGroupBy
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryGroupBy"4 },5 "required": false,6 "description": "Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list.",7 "name": "group_by",8 "in": "query",9 "style": "form",10 "explode": true11}components/schemas/UsageQueryGroupBy
JSON
1{2 "type": "array",3 "items": {4 "type": "string",5 "enum": [6 "project",7 "model",8 "api_key",9 "member"10 ]11 },12 "maxItems": 4,13 "description": "Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list."14}components/parameters/UsageQueryCompare
JSON
1{2 "schema": {3 "$ref": "#/components/schemas/UsageQueryCompare"4 },5 "required": false,6 "description": "Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise.",7 "name": "compare",8 "in": "query"9}components/schemas/UsageQueryCompare
JSON
1{2 "type": "string",3 "enum": [4 "previous_period"5 ],6 "description": "Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise."7}components/schemas/Problem
JSON
1{2 "type": "object",3 "properties": {4 "cause": {5 "type": "string",6 "enum": [7 "schedule_concurrency_forbidden",8 "schedule_fire_in_progress",9 "schedule_run_limit_reached"10 ],11 "description": "Schedule admission refusal."12 },13 "idempotency": {14 "type": "object",15 "properties": {16 "state": {17 "type": "string",18 "enum": [19 "in_progress",20 "payload_mismatch",21 "outcome_unknown"22 ]23 },24 "operation": {25 "type": "string",26 "minLength": 127 },28 "retryable": {29 "type": "boolean"30 },31 "retry_after_seconds": {32 "type": [33 "integer",34 "null"35 ],36 "minimum": 037 },38 "expires_at": {39 "type": [40 "string",41 "null"42 ]43 },44 "recovery": {45 "type": "object",46 "properties": {47 "available": {48 "type": "boolean"49 },50 "description": {51 "type": "string"52 },53 "resource_url": {54 "type": "string"55 }56 },57 "required": [58 "available",59 "description"60 ]61 }62 },63 "required": [64 "state",65 "operation",66 "retryable",67 "retry_after_seconds",68 "expires_at"69 ],70 "description": "Replay status, retry timing, and recovery lookup."71 },72 "type": {73 "type": "string",74 "description": "URI reference identifying the problem type",75 "example": "https://api.veryfront.com/errors/validation-failed"76 },77 "title": {78 "type": "string",79 "description": "Short human-readable summary of the problem",80 "example": "Validation Failed"81 },82 "status": {83 "type": "integer",84 "minimum": 100,85 "maximum": 599,86 "description": "HTTP status code",87 "example": 40088 },89 "code": {90 "type": "string",91 "description": "Stable machine-readable error code",92 "example": "RUN_INVALID_INPUT"93 },94 "detail": {95 "type": "string",96 "description": "Human-readable explanation specific to this occurrence",97 "example": "The 'email' field must be a valid email address"98 },99 "instance": {100 "type": "string",101 "description": "URI reference identifying the specific occurrence",102 "example": "/projects/my-project/members"103 },104 "slug": {105 "type": "string",106 "description": "Stable identifier for the problem type",107 "example": "validation-failed"108 },109 "category": {110 "type": "string",111 "enum": [112 "AUTH",113 "RESOURCE",114 "VALIDATION",115 "DATABASE",116 "SUBSCRIPTION",117 "INTEGRATION",118 "INTERNAL"119 ],120 "description": "API error category",121 "example": "VALIDATION"122 },123 "suggestion": {124 "type": "string",125 "description": "Suggested action to resolve the problem",126 "example": "Check the request body and query parameters against the API documentation."127 },128 "errors": {129 "type": "array",130 "items": {131 "type": "object",132 "properties": {133 "field": {134 "type": "string",135 "description": "Field path that caused the error",136 "example": "email"137 },138 "message": {139 "type": "string",140 "description": "Error message for this field",141 "example": "Invalid email format"142 },143 "code": {144 "type": "string",145 "description": "Error code for this field",146 "example": "INVALID_FORMAT"147 }148 },149 "required": [150 "field",151 "message"152 ]153 },154 "description": "Detailed field-level errors for validation failures"155 }156 },157 "required": [158 "type",159 "title",160 "status"161 ]162}Operation contract
JSON
1{2 "operationId": "getCreditUsage",3 "tags": [4 "billing-usage/Usage/Usage"5 ],6 "summary": "Get credit usage",7 "description": "Break the credit spend of an account down by day, project and model, optionally for one project; returns the series with token counts per model. Requires account.billing.read.",8 "parameters": [9 {10 "schema": {11 "type": "string",12 "format": "uuid"13 },14 "required": true,15 "name": "account_id",16 "in": "path"17 },18 {19 "$ref": "#/components/parameters/UsageQueryPreset"20 },21 {22 "$ref": "#/components/parameters/UsageQueryFrom"23 },24 {25 "$ref": "#/components/parameters/UsageQueryTo"26 },27 {28 "$ref": "#/components/parameters/UsageQueryTimezone"29 },30 {31 "$ref": "#/components/parameters/UsageQueryGranularity"32 },33 {34 "$ref": "#/components/parameters/UsageQueryGroupBy"35 },36 {37 "$ref": "#/components/parameters/UsageQueryCompare"38 },39 {40 "schema": {41 "type": "string",42 "minLength": 1,43 "description": "Project ID or slug that narrows the read to one project of the account. A project of another account is not found."44 },45 "required": false,46 "description": "Project ID or slug that narrows the read to one project of the account. A project of another account is not found.",47 "name": "project_reference",48 "in": "query"49 }50 ],51 "responses": {52 "200": {53 "description": "Credit usage of the account by day, project and model, optionally for one project.",54 "content": {55 "application/json": {56 "schema": {57 "type": "object",58 "properties": {59 "summary": {60 "type": "object",61 "properties": {62 "credits_used": {63 "type": "number",64 "description": "Total credits used."65 },66 "requests": {67 "type": "number",68 "description": "Total AI requests."69 },70 "input_tokens": {71 "type": "number",72 "description": "Total input tokens."73 },74 "output_tokens": {75 "type": "number",76 "description": "Total output tokens."77 },78 "cache_creation_input_tokens": {79 "type": "number",80 "description": "Total cache creation input tokens."81 },82 "cache_read_input_tokens": {83 "type": "number",84 "description": "Total cache read input tokens."85 },86 "previous": {87 "type": "object",88 "properties": {89 "credits_used": {90 "type": "number",91 "description": "Total credits used."92 },93 "requests": {94 "type": "number",95 "description": "Total AI requests."96 },97 "input_tokens": {98 "type": "number",99 "description": "Total input tokens."100 },101 "output_tokens": {102 "type": "number",103 "description": "Total output tokens."104 },105 "cache_creation_input_tokens": {106 "type": "number",107 "description": "Total cache creation input tokens."108 },109 "cache_read_input_tokens": {110 "type": "number",111 "description": "Total cache read input tokens."112 }113 },114 "required": [115 "credits_used",116 "requests",117 "input_tokens",118 "output_tokens",119 "cache_creation_input_tokens",120 "cache_read_input_tokens"121 ]122 }123 },124 "required": [125 "credits_used",126 "requests",127 "input_tokens",128 "output_tokens",129 "cache_creation_input_tokens",130 "cache_read_input_tokens"131 ]132 },133 "timeframe": {134 "type": "object",135 "properties": {136 "from": {137 "type": "string",138 "format": "date-time",139 "description": "Inclusive start."140 },141 "to": {142 "type": "string",143 "format": "date-time",144 "description": "Exclusive end."145 },146 "timezone": {147 "type": "string"148 },149 "granularity": {150 "type": "string",151 "enum": [152 "hour",153 "day",154 "week",155 "month"156 ]157 },158 "bucket_count": {159 "type": "integer",160 "minimum": 0161 },162 "previous": {163 "type": "object",164 "properties": {165 "from": {166 "type": "string",167 "format": "date-time",168 "description": "Inclusive start."169 },170 "to": {171 "type": "string",172 "format": "date-time",173 "description": "Exclusive end."174 },175 "timezone": {176 "type": "string"177 },178 "granularity": {179 "type": "string",180 "enum": [181 "hour",182 "day",183 "week",184 "month"185 ]186 },187 "bucket_count": {188 "type": "integer",189 "minimum": 0190 }191 },192 "required": [193 "from",194 "to",195 "timezone",196 "granularity",197 "bucket_count"198 ]199 }200 },201 "required": [202 "from",203 "to",204 "timezone",205 "granularity",206 "bucket_count"207 ]208 },209 "series": {210 "type": "array",211 "items": {212 "type": "object",213 "properties": {214 "bucket_start": {215 "type": "string",216 "description": "Bucket start timestamp."217 },218 "credits_used": {219 "type": "number",220 "description": "Credits used in the bucket."221 },222 "requests": {223 "type": "number",224 "description": "AI requests in the bucket."225 },226 "input_tokens": {227 "type": "number",228 "description": "Input tokens in the bucket."229 },230 "output_tokens": {231 "type": "number",232 "description": "Output tokens in the bucket."233 },234 "cache_creation_input_tokens": {235 "type": "number",236 "description": "Cache creation input tokens in the bucket."237 },238 "cache_read_input_tokens": {239 "type": "number",240 "description": "Cache read input tokens in the bucket."241 },242 "projects": {243 "type": "array",244 "items": {245 "type": "object",246 "properties": {247 "project_id": {248 "type": [249 "string",250 "null"251 ],252 "format": "uuid",253 "description": "Project ID, or null for unscoped usage."254 },255 "project_name": {256 "type": "string",257 "description": "Project display name."258 },259 "project_slug": {260 "type": [261 "string",262 "null"263 ],264 "description": "Project slug, or null when unavailable."265 },266 "credits_used": {267 "type": "number",268 "description": "Credits used by this project."269 },270 "requests": {271 "type": "number",272 "description": "AI requests billed to this project."273 },274 "input_tokens": {275 "type": "number",276 "description": "Input tokens billed to this project."277 },278 "output_tokens": {279 "type": "number",280 "description": "Output tokens billed to this project."281 },282 "cache_creation_input_tokens": {283 "type": "number",284 "description": "Cache creation input tokens billed to this project."285 },286 "cache_read_input_tokens": {287 "type": "number",288 "description": "Cache read input tokens billed to this project."289 }290 },291 "required": [292 "project_id",293 "project_name",294 "project_slug",295 "credits_used",296 "requests",297 "input_tokens",298 "output_tokens",299 "cache_creation_input_tokens",300 "cache_read_input_tokens"301 ]302 }303 },304 "groups": {305 "type": "array",306 "items": {307 "type": "object",308 "properties": {309 "credits_used": {310 "type": "number",311 "description": "Total credits used."312 },313 "requests": {314 "type": "number",315 "description": "Total AI requests."316 },317 "input_tokens": {318 "type": "number",319 "description": "Total input tokens."320 },321 "output_tokens": {322 "type": "number",323 "description": "Total output tokens."324 },325 "cache_creation_input_tokens": {326 "type": "number",327 "description": "Total cache creation input tokens."328 },329 "cache_read_input_tokens": {330 "type": "number",331 "description": "Total cache read input tokens."332 },333 "dimensions": {334 "type": "object",335 "properties": {336 "project_id": {337 "type": [338 "string",339 "null"340 ],341 "format": "uuid"342 },343 "model": {344 "type": [345 "string",346 "null"347 ]348 },349 "model_provider": {350 "type": [351 "string",352 "null"353 ]354 },355 "api_key_id": {356 "type": [357 "string",358 "null"359 ],360 "format": "uuid"361 },362 "api_key_kind": {363 "type": "string",364 "enum": [365 "api_key",366 "no_api_key",367 "other_keys",368 "deleted_keys",369 "unattributed"370 ],371 "description": "Key-listing reports distinguish named keys, other/deleted keys, keyless and unattributed usage."372 },373 "member_id": {374 "type": [375 "string",376 "null"377 ],378 "format": "uuid"379 },380 "member_kind": {381 "type": "string",382 "enum": [383 "member",384 "former_member",385 "deleted_users",386 "automations",387 "unattributed"388 ],389 "description": "Project-member reports distinguish named people, deleted users, automations and unattributed usage."390 }391 }392 }393 },394 "required": [395 "credits_used",396 "requests",397 "input_tokens",398 "output_tokens",399 "cache_creation_input_tokens",400 "cache_read_input_tokens",401 "dimensions"402 ]403 }404 }405 },406 "required": [407 "bucket_start",408 "credits_used",409 "requests",410 "input_tokens",411 "output_tokens",412 "cache_creation_input_tokens",413 "cache_read_input_tokens",414 "projects"415 ]416 }417 },418 "projects": {419 "type": "array",420 "items": {421 "type": "object",422 "properties": {423 "project_id": {424 "type": [425 "string",426 "null"427 ],428 "format": "uuid",429 "description": "Project ID, or null for unscoped usage."430 },431 "project_name": {432 "type": "string",433 "description": "Project display name."434 },435 "project_slug": {436 "type": [437 "string",438 "null"439 ],440 "description": "Project slug, or null when unavailable."441 },442 "credits_used": {443 "type": "number",444 "description": "Credits used by this project."445 },446 "requests": {447 "type": "number",448 "description": "AI requests billed to this project."449 },450 "input_tokens": {451 "type": "number",452 "description": "Input tokens billed to this project."453 },454 "output_tokens": {455 "type": "number",456 "description": "Output tokens billed to this project."457 },458 "cache_creation_input_tokens": {459 "type": "number",460 "description": "Cache creation input tokens billed to this project."461 },462 "cache_read_input_tokens": {463 "type": "number",464 "description": "Cache read input tokens billed to this project."465 }466 },467 "required": [468 "project_id",469 "project_name",470 "project_slug",471 "credits_used",472 "requests",473 "input_tokens",474 "output_tokens",475 "cache_creation_input_tokens",476 "cache_read_input_tokens"477 ]478 }479 },480 "models": {481 "type": "array",482 "items": {483 "type": "object",484 "properties": {485 "funding": {486 "type": "string",487 "enum": [488 "managed",489 "customer",490 "mixed"491 ],492 "description": "Recorded credential funding; omitted when unknown. Credits always reflect the historical ledger."493 },494 "model": {495 "type": "string",496 "description": "Canonical or normalized AI model identifier."497 },498 "canonical_model_id": {499 "type": "string",500 "description": "Canonical catalog model identifier."501 },502 "model_provider": {503 "type": "string",504 "description": "Model vendor id. Known values: `anthropic`, `openai`, `google`, `mistral`, `moonshotai`, `deepseek`, `qwen`, `zai`, `unknown`. Other vendor ids may appear; clients must accept any string.",505 "example": "anthropic"506 },507 "inference_provider": {508 "type": "string",509 "description": "Inference provider handling the request. Known values: `veryfront-cloud`, `unknown`. Other values may appear; clients must accept any string.",510 "example": "veryfront-cloud"511 },512 "credits_used": {513 "type": "number",514 "description": "Credits used by this model."515 },516 "requests": {517 "type": "number",518 "description": "AI requests billed to this model."519 },520 "input_tokens": {521 "type": "number",522 "description": "Input tokens billed to this model."523 },524 "output_tokens": {525 "type": "number",526 "description": "Output tokens billed to this model."527 },528 "cache_creation_input_tokens": {529 "type": "number",530 "description": "Cache creation input tokens billed to this model."531 },532 "cache_read_input_tokens": {533 "type": "number",534 "description": "Cache read input tokens billed to this model."535 },536 "provider_cost_usd": {537 "type": "number",538 "description": "Model provider cost in USD for this model."539 },540 "veryfront_charge_usd": {541 "type": "number",542 "description": "Veryfront charge in USD for this model."543 },544 "cost_attribution": {545 "type": "string",546 "enum": [547 "estimated"548 ],549 "description": "Present when historical cost attribution was recovered from persisted credits."550 }551 },552 "required": [553 "model",554 "model_provider",555 "inference_provider",556 "credits_used",557 "requests",558 "input_tokens",559 "output_tokens",560 "cache_creation_input_tokens",561 "cache_read_input_tokens"562 ]563 }564 },565 "serving": {566 "type": "array",567 "items": {568 "type": "object",569 "properties": {570 "host": {571 "type": [572 "string",573 "null"574 ],575 "description": "Catalog ID of the deployment host, not a provider hostname or URL. Null means no deployment was recorded, including older usage, calls without a catalog deployment, and aggregated channel usage. Null does not indicate where inference ran."576 },577 "tier": {578 "type": [579 "string",580 "null"581 ],582 "description": "Sovereignty tier as a catalog ID. Clients must accept unknown values as tiers can be added. Null means no tier was recorded and does not indicate where inference ran. The API does not infer a tier from billing or other fields.",583 "example": "eu-resident"584 },585 "funding": {586 "type": "string",587 "enum": [588 "managed",589 "customer",590 "mixed"591 ],592 "description": "Recorded funding for this spend group; omitted when provenance is unknown."593 },594 "credits": {595 "type": "number",596 "description": "Credits debited in the timeframe."597 },598 "usd": {599 "type": "number",600 "description": "Customer-billed USD for those credits."601 },602 "requests": {603 "type": "number",604 "description": "Number of provider calls recorded."605 },606 "input_tokens": {607 "type": "number",608 "description": "Input tokens."609 },610 "output_tokens": {611 "type": "number",612 "description": "Output tokens."613 },614 "cache_read_tokens": {615 "type": "number",616 "description": "Tokens read from the prompt cache."617 },618 "cache_creation_tokens": {619 "type": "number",620 "description": "Tokens written to the prompt cache."621 }622 },623 "required": [624 "host",625 "tier",626 "credits",627 "usd",628 "requests",629 "input_tokens",630 "output_tokens",631 "cache_read_tokens",632 "cache_creation_tokens"633 ]634 },635 "description": "The same spend cut by the deployment that served it. Ordered by spend descending, then by request count descending, then by host, then by tier; the row whose `host` and `tier` are both null is always last, because it is the absence of a record rather than a deployment. Additive: it neither replaces nor re-slices any other field. Omitted where the serving breakdown is not enabled; `models` is unchanged by it."636 },637 "scope": {638 "type": "object",639 "properties": {640 "kind": {641 "type": "string",642 "enum": [643 "account"644 ]645 },646 "account_id": {647 "type": "string",648 "format": "uuid"649 },650 "project_id": {651 "type": [652 "string",653 "null"654 ],655 "format": "uuid"656 }657 },658 "required": [659 "kind",660 "account_id",661 "project_id"662 ]663 },664 "group_by": {665 "type": "array",666 "items": {667 "type": "string",668 "enum": [669 "project",670 "model",671 "api_key",672 "member"673 ]674 }675 }676 },677 "required": [678 "summary",679 "timeframe",680 "series",681 "projects",682 "models"683 ]684 }685 }686 }687 },688 "400": {689 "description": "Bad request",690 "content": {691 "application/problem+json": {692 "schema": {693 "$ref": "#/components/schemas/Problem"694 }695 }696 }697 },698 "401": {699 "description": "Unauthorized",700 "content": {701 "application/problem+json": {702 "schema": {703 "$ref": "#/components/schemas/Problem"704 }705 }706 }707 },708 "403": {709 "description": "Forbidden",710 "content": {711 "application/problem+json": {712 "schema": {713 "$ref": "#/components/schemas/Problem"714 }715 }716 }717 },718 "404": {719 "description": "Not found",720 "content": {721 "application/problem+json": {722 "schema": {723 "$ref": "#/components/schemas/Problem"724 }725 }726 }727 },728 "500": {729 "description": "Server error",730 "content": {731 "application/problem+json": {732 "schema": {733 "$ref": "#/components/schemas/Problem"734 }735 }736 }737 }738 },739 "x-documentation-source-tag": "Account billing",740 "x-canonical-documentation": {741 "domain": "billing-usage",742 "resource": "Usage",743 "subgroup": "Usage",744 "name": "Get credit usage",745 "description": "Break the credit spend of an account down by day, project and model, optionally for one project; returns the series with token counts per model. Requires account.billing.read.",746 "operationId": "getCreditUsage"747 },748 "x-mint": {749 "href": "/cloud/rest/api-reference/billing-usage-usage-usage/get-credit-usage"750 }751}