# Credit caps and receipts

> Cap what a request can spend and reconcile the settled credits with your account.

Canonical URL: https://quantset.dev/docs/guides/credit-metering
Full LLM API Contract: https://api.quantset.dev/llms-full.txt

> ## For AI agents
> The QuantSet API is at https://api.quantset.dev. Send the key in the `X-API-Key` header. The sandbox key `mw_demo` needs no signup and reads the sample listings.
> No key yet? An agent can open an account on its own: https://api.quantset.dev/skill.md
> Connect an MCP client to https://api.quantset.dev/mcp. Client setup is at https://api.quantset.dev/agents.md.
> Start with https://api.quantset.dev/llms.txt or read the full reference at https://api.quantset.dev/llms-full.txt. The OpenAPI file is https://api.quantset.dev/openapi.json. Add `.md` to any docs URL to get that page as Markdown.

Set a ceiling on what a request can spend and reconcile the settled charge from its receipt.
    

## How a request is priced

    

The [active rate card](https://api.quantset.dev/api/v1/billing/rate-card) lists the billing unit for every operation. Settlement measures the records actually delivered. Read `included_units`, `block_size` and `rounding` from the active rule to see how those records become credits. On the initial card, a page of 200 daily bars settles at one credit and a page of 251 settles at two. The macro series catalog remains free discovery. Historical macro observations and FX reads use their published tariff.
    

## Enforce a credit limit

    
```
curl "https://api.quantset.dev/api/v1/prices?ticker=NVDA&limit=251" \
  -H "X-API-Key: $QUANTSET_API_KEY" \
  -H 'X-Max-Credits: 2' -H 'X-Workflow-Id: research-session-1' -i
```

    

A metered request that exceeds X-Max-Credits returns 422 credit_budget_exceeded and charges zero. If a wallet cannot fund the request, 402 insufficient_credits reports credits_remaining and either the exact required_credits or a maximum_credits ceiling. When supplied, affordable_page names a smaller limit and value that fits your budget. Choose a smaller page or top up before retrying. Request-rate limits use 429 and Retry-After.
    

## Read the receipt

    

X-Credit-Cost is the settled charge. X-Credits-Remaining is the spendable wallet balance when supplied. Store X-Request-Id and X-Rate-Card-Version to reconcile the call with account usage. The same logical query uses the same tariff for JSON and CSV. Cursors retain the billing version for their continuation.
    

## Cap an MCP or SDK workflow

    

Pass `max_credits` to an MCP data tool and inspect `_meta.credit_cost` on its result. The remote tool can also accept X-Max-Credits on the transport; the tighter ceiling applies.
    

For multi-page prices, the Python SDK accepts `credit_budget` and JavaScript accepts `creditBudget` alongside the maximum number of pages. Both send the remaining budget on each call and expose per-page receipts. See [SDK setup](/docs/integrations/sdks) and [pagination](/docs/guides/pagination).

---

## QuantSet Ecosystem & Integrations (https://quantset.dev/integrations)

- **MCP Clients & 7 Skills:** `npx quantset init` & `npx skills add quantset/skills` (Claude, Claude Code, Cursor, ChatGPT, Codex, Hermes, OpenClaw, Block Goose, Cline, Docker MCP Toolkit — `https://api.quantset.dev/mcp`)
- **Python SDK & Agent Frameworks:** `pip install "quantset[pandas]"` · `from quantset.tools import build_agent_functions, langchain_tools, crewai_tools` (PydanticAI, LangGraph, LangChain, CrewAI, Agno, AutoGen, Google ADK, OpenAI Agents SDK)
- **TypeScript SDK & Vercel AI / Mastra:** `npm install quantset` · `import { createQuantsetTools } from "quantset/tools"` (Node 20+, Bun, Deno, Cloudflare Workers, Vercel Edge)
- **Spreadsheets & Workspaces:** Google Sheets (`=QUANTSET()` & `=IMPORTDATA()`), Microsoft Excel Power Query (`?format=csv`), Notion MCP & n8n/Make webhooks (`https://quantset.dev/docs/guides/google-sheets-excel-notion-stock-templates`)
- **Drop-In Migrations & Machine Payments:** Supported FMP `/stable/*` and `/api/v3/*` operations (`https://quantset.dev/docs/switch/fmp`), `yfinance` migration (`https://quantset.dev/docs/switch/yfinance`), autonomous signup (`https://api.quantset.dev/skill.md`), and `x402` Base USDC.
