costQL
offline-firstTry the playground
GraphQL cost, quoted offline

Price GraphQL queries before you run them.

Point costQL at your API once.
It writes a pricing pack: one small file your app can use to price any query, instantly, with no calls to a server.

costql quote
tmdb_t3.json · fully offline
movie(id)4.0
cast(limit:8)12.5
person.name ×834.0
typical estimate36.4
confidencehigh
work-time (ms)50.5
~4%
at T1
average pricing error on a public API we don't run, with zero server changes
5/5
at T1
test queries where the quoted ceiling was never below the real cost
38.5×
at T3
repeated work our test database merged into single calls: costQL saw it and priced it once

T1 and T3 are two of costQL's three depths of fidelity: you pick the one your needs justify.

Build once. Quote anywhere.

Three steps take you from a live endpoint to a pricing pack your app carries with it.

step 1

Adapt

Tell costQL where your API lives and give it a few real IDs to query with. That's a short adapter file, about 90 lines. Three finished examples ship in the repo.

The adapter guide →
step 2

Build

Run costql build. It sends calibration queries to your API, times the answers, and saves everything it learned as one JSON file: the pricing pack.

schema + rates + fees → one JSON
step 3

Quote

Load the pack in Python or JavaScript and price queries right where your code runs, with no more calls to your API. Both languages give the exact same answer.

Quote your first pack →
from costql import PricingPack

pack = PricingPack.load("tmdb_t3.json")          # one static file
quote = pack.quote('{ movie(id:"27205"){ cast(limit:8){ person{ name } } } }')

quote["price"]         # 50.5   the most this query should cost
quote["typical_price"] # 36.4   what it usually costs
quote["confidence"]    # "high"

Three depths of fidelity. Pick by need.

Every price is in work-time (ms): how much real work a query causes on your server. The tiers are how sharply costQL can see that work, and you only go as deep as your needs justify. Not everybody needs T3: T1 or T2 is often enough.

T1

Works with any API

costQL times whole queries from the outside. No server changes at all. Every API starts here, and in our tests it was already accurate to about 4%.
T2

Sees each field

Your server reports how long each field takes to resolve. costQL stops guessing about work that happens in parallel, so prices track the real work more closely.
T3

Sees shared work

Your server reports when it batches or reuses work. costQL prices that work once instead of many times. On our most share-heavy test, this cut error from 315% to 12%.
Where you'll start:your first pack will be T1. It works today, with no server changes, and it already gives you a safe ceiling. The packs in the playground are T3 only because we run those demo servers ourselves. When you want sharper prices, the tiers guide shows the one change to make.

Price your first query in 60 seconds

no signup, no server

This is the real costQL engine, loaded on this page with three ready-made packs. Build a query from the schema on the left, or type your own: the price updates as you type.