Skip to main content

Overview

Every GraphQL query consumes Credit Units (CU) that are dynamically calculated based on the query’s complexity. Credits are deducted from the same billing plan as the REST API — your API Key works across both.
The GraphQL API shares the same API Key and billing plan as the REST Data API. Credits consumed by GraphQL queries count toward your overall usage.

Credit Calculation Formula

Credits are calculated per Cube using a 5-factor formula. The final CU depends on what you query, how many rows you request, whether you use aggregation, how many metrics you include, and how many fields you select.
Zero-row queries are free. If a query returns no rows, no credits are charged regardless of the other factors.

Calculation Examples

Since CU is dynamically calculated, the best way to know the exact cost of a query is to check the extensions.credits field in the response, or monitor the CU indicator in the IDE status bar.

Response: extensions.credits

Every GraphQL response includes credit consumption details in the extensions field:
The extensions.credits field is present when credits are consumed (i.e., total > 0). Queries that return zero rows are not charged.

Monitoring Usage in the IDE

The GraphQL IDE status bar displays credit consumption after each query:
  • CU indicator: Displays the total CU consumed
  • Latency: Request duration in milliseconds
  • Response size: Payload size

Tips for Optimizing Credit Usage

Select Fewer Fields

Only request the dimensions you need. The ComplexityFactor increases with the number of selected fields.

Use Appropriate Limits

Keep limit.count as low as practical. The LimitFactor doubles for every 100 additional rows.

Use Pre-aggregated Cubes

For aggregated data, prefer DWM/DWS Cubes (Pairs, Tokens, TokenHolders) over running metrics on DWD Cubes (DEXTrades).

General Billing & Units

Overview of ChainStream billing plans, unit quotas, and payment methods.

Metrics & Aggregation

Learn how aggregation metrics affect query credits.