Get credit usage

veryfront__get_credit_usage

Requires account.billing.read.

Access

No external-service connection is required. Use a Veryfront credential with access to the requested resources.

Call type: Read-only.

Arguments

FieldTypeRequiredDescription and constraints
presetstringNoWhole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults. Default: "30d". Values: "7d", "30d", "90d".
fromstringNoInclusive start. Supply both from and to; these bounds take precedence over preset. Format: date-time.
tostringNoExclusive end, no later than the end of today in timezone.
timezonestringNoProvide the timezone. Default: "UTC".
granularitystringNoUTC hours, or local calendar days, Monday-based weeks and months. Default: "day". Values: "hour", "day", "week", "month".
group_bystring[]NoGrouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list.
comparestringNoCompare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise. Value: "previous_period".
project_referencestringNoProject ID or slug that narrows the read to one project of the account. A project of another account is not found. Minimum length: 1.

Example request

Send this JSON-RPC request through an initialized MCP client. Replace sample identifiers and values before calling the tool. See MCP client setup.

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "veryfront__get_credit_usage",
    "arguments": {}
  }
}

Result

The published output shape is summarized below. Inspect both the MCP response content and isError when handling a call.

FieldTypeRequiredDescription and constraints
summaryobjectYesStructured summary details associated with this tool result.
timeframeobjectYesStructured timeframe details associated with this tool result.
seriesobject[]YesList of series associated with this tool result.
projectsobject[]YesList of projects associated with this tool result.
modelsobject[]YesList of models associated with this tool result.
servingobject[]No
scopeobjectNo
group_bystring[]No

Full schemas

json
{
  "type": "object",
  "properties": {
    "preset": {
      "type": "string",
      "enum": [
        "7d",
        "30d",
        "90d"
      ],
      "description": "Whole local days, defaulting to 30d. Explicit from/to bounds take precedence over preset, including SDK-supplied defaults.",
      "default": "30d"
    },
    "from": {
      "type": "string",
      "format": "date-time",
      "description": "Inclusive start. Supply both from and to; these bounds take precedence over preset."
    },
    "to": {
      "$ref": "#/properties/from",
      "description": "Exclusive end, no later than the end of today in timezone."
    },
    "timezone": {
      "type": "string",
      "description": "Provide the timezone.",
      "default": "UTC"
    },
    "granularity": {
      "type": "string",
      "enum": [
        "hour",
        "day",
        "week",
        "month"
      ],
      "description": "UTC hours, or local calendar days, Monday-based weeks and months.",
      "default": "day"
    },
    "group_by": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "project",
          "model",
          "api_key",
          "member"
        ],
        "description": "One group by item supplied to the tool."
      },
      "maxItems": 4,
      "description": "Grouping dimensions supported by this operation. Repeat the parameter or use a comma-separated list."
    },
    "compare": {
      "type": "string",
      "const": "previous_period",
      "description": "Compare preceding calendar months for whole-month custom ranges, local days for whole-day ranges and presets, or equal elapsed duration otherwise."
    },
    "project_reference": {
      "type": "string",
      "minLength": 1,
      "description": "Project ID or slug that narrows the read to one project of the account. A project of another account is not found."
    }
  },
  "additionalProperties": false,
  "description": "Arguments for the get_credit_usage tool.",
  "$schema": "http://json-schema.org/draft-07/schema#"
}
json
{
  "type": "object",
  "properties": {
    "summary": {
      "type": "object",
      "properties": {
        "credits_used": {
          "type": "number"
        },
        "requests": {
          "type": "number"
        },
        "input_tokens": {
          "type": "number"
        },
        "output_tokens": {
          "type": "number"
        },
        "cache_creation_input_tokens": {
          "type": "number"
        },
        "cache_read_input_tokens": {
          "type": "number"
        },
        "previous": {
          "type": "object",
          "properties": {
            "credits_used": {
              "$ref": "#/properties/summary/properties/credits_used",
              "description": "The credits used returned by the tool."
            },
            "requests": {
              "$ref": "#/properties/summary/properties/requests",
              "description": "The requests returned by the tool."
            },
            "input_tokens": {
              "$ref": "#/properties/summary/properties/input_tokens",
              "description": "The input tokens returned by the tool."
            },
            "output_tokens": {
              "$ref": "#/properties/summary/properties/output_tokens",
              "description": "The output tokens returned by the tool."
            },
            "cache_creation_input_tokens": {
              "$ref": "#/properties/summary/properties/cache_creation_input_tokens",
              "description": "The cache creation input tokens returned by the tool."
            },
            "cache_read_input_tokens": {
              "$ref": "#/properties/summary/properties/cache_read_input_tokens",
              "description": "The cache read input tokens returned by the tool."
            }
          },
          "required": [
            "credits_used",
            "requests",
            "input_tokens",
            "output_tokens",
            "cache_creation_input_tokens",
            "cache_read_input_tokens"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "credits_used",
        "requests",
        "input_tokens",
        "output_tokens",
        "cache_creation_input_tokens",
        "cache_read_input_tokens"
      ],
      "additionalProperties": false,
      "description": "Structured summary details associated with this tool result."
    },
    "timeframe": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string",
          "format": "date-time",
          "description": "Inclusive start."
        },
        "to": {
          "type": "string",
          "format": "date-time",
          "description": "Exclusive end."
        },
        "timezone": {
          "type": "string"
        },
        "granularity": {
          "type": "string",
          "enum": [
            "hour",
            "day",
            "week",
            "month"
          ]
        },
        "bucket_count": {
          "type": "integer",
          "minimum": 0
        },
        "previous": {
          "type": "object",
          "properties": {
            "from": {
              "$ref": "#/properties/timeframe/properties/from",
              "description": "The from returned by the tool."
            },
            "to": {
              "$ref": "#/properties/timeframe/properties/to",
              "description": "The to returned by the tool."
            },
            "timezone": {
              "$ref": "#/properties/timeframe/properties/timezone",
              "description": "The timezone returned by the tool."
            },
            "granularity": {
              "$ref": "#/properties/timeframe/properties/granularity",
              "description": "The granularity returned by the tool."
            },
            "bucket_count": {
              "$ref": "#/properties/timeframe/properties/bucket_count",
              "description": "The bucket count returned by the tool."
            }
          },
          "required": [
            "from",
            "to",
            "timezone",
            "granularity",
            "bucket_count"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "from",
        "to",
        "timezone",
        "granularity",
        "bucket_count"
      ],
      "additionalProperties": false,
      "description": "Structured timeframe details associated with this tool result."
    },
    "series": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "bucket_start": {
            "type": "string"
          },
          "credits_used": {
            "type": "number"
          },
          "requests": {
            "type": "number"
          },
          "input_tokens": {
            "type": "number"
          },
          "output_tokens": {
            "type": "number"
          },
          "cache_creation_input_tokens": {
            "type": "number"
          },
          "cache_read_input_tokens": {
            "type": "number"
          },
          "projects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "project_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "description": "Project identifier associated with this result."
                    },
                    {
                      "type": "null",
                      "description": "Project identifier associated with this result."
                    }
                  ],
                  "description": "Project identifier associated with this result."
                },
                "project_name": {
                  "type": "string"
                },
                "project_slug": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "credits_used": {
                  "type": "number"
                },
                "requests": {
                  "type": "number"
                },
                "input_tokens": {
                  "type": "number"
                },
                "output_tokens": {
                  "type": "number"
                },
                "cache_creation_input_tokens": {
                  "type": "number"
                },
                "cache_read_input_tokens": {
                  "type": "number"
                }
              },
              "required": [
                "project_id",
                "project_name",
                "project_slug",
                "credits_used",
                "requests",
                "input_tokens",
                "output_tokens",
                "cache_creation_input_tokens",
                "cache_read_input_tokens"
              ],
              "additionalProperties": false
            },
            "description": "List of projects associated with this tool result."
          },
          "groups": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "credits_used": {
                  "$ref": "#/properties/summary/properties/credits_used",
                  "description": "The credits used returned by the tool."
                },
                "requests": {
                  "$ref": "#/properties/summary/properties/requests",
                  "description": "The requests returned by the tool."
                },
                "input_tokens": {
                  "$ref": "#/properties/summary/properties/input_tokens",
                  "description": "The input tokens returned by the tool."
                },
                "output_tokens": {
                  "$ref": "#/properties/summary/properties/output_tokens",
                  "description": "The output tokens returned by the tool."
                },
                "cache_creation_input_tokens": {
                  "$ref": "#/properties/summary/properties/cache_creation_input_tokens",
                  "description": "The cache creation input tokens returned by the tool."
                },
                "cache_read_input_tokens": {
                  "$ref": "#/properties/summary/properties/cache_read_input_tokens",
                  "description": "The cache read input tokens returned by the tool."
                },
                "dimensions": {
                  "type": "object",
                  "properties": {
                    "project_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid",
                          "description": "Project identifier associated with this result."
                        },
                        {
                          "type": "null",
                          "description": "Project identifier associated with this result."
                        }
                      ],
                      "description": "Project identifier associated with this result."
                    },
                    "model": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "AI model id associated with this tool result."
                    },
                    "model_provider": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "api_key_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null",
                          "description": "The api key id returned by the tool."
                        }
                      ]
                    },
                    "api_key_kind": {
                      "type": "string",
                      "enum": [
                        "api_key",
                        "no_api_key",
                        "other_keys",
                        "deleted_keys",
                        "unattributed"
                      ],
                      "description": "Key-listing reports distinguish named keys, other/deleted keys, keyless and unattributed usage."
                    },
                    "member_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "uuid"
                        },
                        {
                          "type": "null",
                          "description": "The member id returned by the tool."
                        }
                      ]
                    },
                    "member_kind": {
                      "type": "string",
                      "enum": [
                        "member",
                        "former_member",
                        "deleted_users",
                        "automations",
                        "unattributed"
                      ],
                      "description": "Project-member reports distinguish named people, deleted users, automations and unattributed usage."
                    }
                  },
                  "additionalProperties": false,
                  "description": "Structured dimensions details associated with this tool result."
                }
              },
              "required": [
                "credits_used",
                "requests",
                "input_tokens",
                "output_tokens",
                "cache_creation_input_tokens",
                "cache_read_input_tokens",
                "dimensions"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "bucket_start",
          "credits_used",
          "requests",
          "input_tokens",
          "output_tokens",
          "cache_creation_input_tokens",
          "cache_read_input_tokens",
          "projects"
        ],
        "additionalProperties": false
      },
      "description": "List of series associated with this tool result."
    },
    "projects": {
      "type": "array",
      "items": {
        "$ref": "#/properties/series/items/properties/projects/items",
        "description": "One project item returned by the tool."
      },
      "description": "List of projects associated with this tool result."
    },
    "models": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "funding": {
            "type": "string",
            "enum": [
              "managed",
              "customer",
              "mixed"
            ],
            "description": "Recorded credential funding; omitted when unknown. Credits always reflect the historical ledger."
          },
          "model": {
            "type": "string",
            "description": "AI model id associated with this tool result."
          },
          "canonical_model_id": {
            "type": "string"
          },
          "model_provider": {
            "type": "string"
          },
          "inference_provider": {
            "type": "string"
          },
          "credits_used": {
            "type": "number"
          },
          "requests": {
            "type": "number"
          },
          "input_tokens": {
            "type": "number"
          },
          "output_tokens": {
            "type": "number"
          },
          "cache_creation_input_tokens": {
            "type": "number"
          },
          "cache_read_input_tokens": {
            "type": "number"
          },
          "provider_cost_usd": {
            "type": "number"
          },
          "veryfront_charge_usd": {
            "type": "number"
          },
          "cost_attribution": {
            "type": "string",
            "enum": [
              "estimated"
            ]
          }
        },
        "required": [
          "model",
          "model_provider",
          "inference_provider",
          "credits_used",
          "requests",
          "input_tokens",
          "output_tokens",
          "cache_creation_input_tokens",
          "cache_read_input_tokens"
        ],
        "additionalProperties": false
      },
      "description": "List of models associated with this tool result."
    },
    "serving": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "host": {
            "type": [
              "string",
              "null"
            ]
          },
          "tier": {
            "type": [
              "string",
              "null"
            ]
          },
          "funding": {
            "type": "string",
            "enum": [
              "managed",
              "customer",
              "mixed"
            ],
            "description": "Recorded funding for this spend group; omitted when provenance is unknown."
          },
          "credits": {
            "type": "number"
          },
          "usd": {
            "type": "number"
          },
          "requests": {
            "type": "number"
          },
          "input_tokens": {
            "type": "number"
          },
          "output_tokens": {
            "type": "number"
          },
          "cache_read_tokens": {
            "type": "number"
          },
          "cache_creation_tokens": {
            "type": "number"
          }
        },
        "required": [
          "host",
          "tier",
          "credits",
          "usd",
          "requests",
          "input_tokens",
          "output_tokens",
          "cache_read_tokens",
          "cache_creation_tokens"
        ],
        "additionalProperties": false
      }
    },
    "scope": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "account"
        },
        "account_id": {
          "type": "string",
          "format": "uuid"
        },
        "project_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid",
              "description": "Project identifier associated with this result."
            },
            {
              "type": "null",
              "description": "Project identifier associated with this result."
            }
          ],
          "description": "Project identifier associated with this result."
        }
      },
      "required": [
        "kind",
        "account_id",
        "project_id"
      ],
      "additionalProperties": false
    },
    "group_by": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "project",
          "model",
          "api_key",
          "member"
        ]
      }
    }
  },
  "required": [
    "summary",
    "timeframe",
    "series",
    "projects",
    "models"
  ],
  "additionalProperties": false,
  "description": "Structured result returned by the get_credit_usage tool.",
  "$schema": "http://json-schema.org/draft-07/schema#"
}