Overview
Every GraphQL query consumes Credit Units (CU) based on the Cube queried, the number of rows requested, and the complexity of aggregation. 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 the following formula:| Factor | Calculation | Description |
|---|---|---|
| BaseCost | Per-Cube base price (see table below) | Fixed cost that varies by Cube complexity |
| LimitFactor | ceil(limit / 100), minimum 1 | Scales with the number of rows requested |
| AggregationFactor | 1.0 (none), 1.5 (GROUP BY), 2.0 (HAVING) | Higher for queries using aggregation or HAVING filters |
| MetricFactor | 1.0 + (metric_count × 0.2) | Increases with each additional metric (count, sum, etc.) |
Calculation Examples
Simple query: 10 DEXTrades rows
Simple query: 10 DEXTrades rows
Large query: 500 DEXTrades rows
Large query: 500 DEXTrades rows
Aggregation query: 500 rows + GROUP BY + 2 metrics
Aggregation query: 500 rows + GROUP BY + 2 metrics
Base Cost per Cube
| Cube | Base Cost (CU) | Notes |
|---|---|---|
| DEXTrades | 50 | Largest table with most dimensions |
| DEXTradeByTokens | 50 | Same underlying data as DEXTrades |
| DEXPoolEvents | 30 | Liquidity events |
| Pairs | 30 | OHLC candlestick data (Trading group) |
| Tokens | 30 | Token trade statistics (Trading group) |
| WalletTokenPnL | 25 | DWS summary |
| Transfers | 15 | |
| BalanceUpdates | 10 | |
| Events, Calls | 20 | EVM-only trace/event data |
| Instructions | 20 | Solana-only |
| PredictionTrades | 20 | Prediction market data |
| All other Cubes | 20 | Default base cost |
Base costs reflect query complexity and the underlying data volume of each Cube. The actual Cube name reported in
extensions.credits is determined by the server — always use the response value as the authoritative billing reference.Response: extensions.credits
Every GraphQL response includes credit consumption details in the extensions field:
| Field | Type | Description |
|---|---|---|
total | Int | Total credits consumed by the entire query |
cubes | Array | Per-Cube breakdown |
cubes[].cube | String | Cube name |
cubes[].credits | Int | Credits charged for this Cube |
cubes[].row_count | Int | Number of rows returned |
The
extensions.credits field is present when credits are consumed (i.e., total > 0). Queries that return zero rows still incur the base cost.Monitoring Usage in the IDE
The GraphQL IDE status bar displays credit consumption after each query:- CU indicator: Displays the total CU consumed (e.g.,
50 CU) - Latency: Request duration in milliseconds
- Response size: Payload size
Tips for Optimizing Credit Usage
Select Fewer Fields
Only request the dimensions you need. Fewer fields means less data processed.
Use Appropriate Limits
Keep
limit.count as low as practical. Credits scale with ceil(limit / 100).Use Pre-aggregated Cubes
For aggregated data, prefer DWM/DWS Cubes (Pairs, Tokens, TokenHolders) over running metrics on DWD Cubes (DEXTrades).
Related Documentation
General Billing & Units
Overview of ChainStream billing plans, unit quotas, and payment methods.
Metrics & Aggregation
Learn how aggregation metrics affect query credits.

