> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get credit usage

> 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.

`creditUsage(input: CreditUsageInput): CreditUsage!`

Requires account.billing.read.

## Arguments

| Argument | Type | Required |
| - | - | - |
| `input` | [`CreditUsageInput`](https://veryfront.com/docs/cloud/graphql/types/creditusageinput) | No |

## Input fields

### input

[`CreditUsageInput`](https://veryfront.com/docs/cloud/graphql/types/creditusageinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `preset` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | 7d, 30d or 90d. Defaults to 30d. |
| `timezone` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | IANA time zone for daily bucket boundaries. Defaults to UTC. |
| `projectReference` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Project ID or slug that narrows the read to one project of the account |

## Response

Returns [`CreditUsage!`](https://veryfront.com/docs/cloud/graphql/types/creditusage). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `summary` | [`CreditUsageTotals!`](https://veryfront.com/docs/cloud/graphql/types/creditusagetotals) | |
| `timeframe` | [`UsageTimeframe!`](https://veryfront.com/docs/cloud/graphql/types/usagetimeframe) | |
| `series` | [`[CreditUsageBucket!]!`](https://veryfront.com/docs/cloud/graphql/types/creditusagebucket) | |
| `projects` | [`[CreditUsageProject!]!`](https://veryfront.com/docs/cloud/graphql/types/creditusageproject) | |
| `models` | [`[CreditUsageModel!]!`](https://veryfront.com/docs/cloud/graphql/types/creditusagemodel) | |
| `serving` | [`[CreditUsageServing!]`](https://veryfront.com/docs/cloud/graphql/types/creditusageserving) | Omitted where the serving breakdown is not enabled |

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
query CreditUsage($input: CreditUsageInput) {
  creditUsage(input: $input) {
    summary {
      cacheCreationInputTokens
      cacheReadInputTokens
      creditsUsed
      inputTokens
      outputTokens
    }
    timeframe {
      bucketCount
      from
      granularity
      timezone
      to
    }
    series {
      bucketStart
      cacheCreationInputTokens
      cacheReadInputTokens
      creditsUsed
      inputTokens
    }
  }
}
```

```json title="variables.json" theme={null}
{}
```

<details>
  <summary>Try this query</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Query

  Variables (JSON)
</details>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.