Receipts & Billing

Exact cost, tokens, and latency for every request

Receipts

Every response — including error responses after admission, and streamed responses — carries two headers:

  • x-singularity-request-id
  • x-singularity-receipt-id

Fetch the receipt any time with GET /v1/receipts/{id}. There’s no SDK helper for this endpoint — call it directly.

$curl https://api.singularityapi.dev/v1/receipts/RECEIPT_ID \
> -H "Authorization: Bearer $SINGULARITY_API_KEY"

A full receipt looks like this:

1{
2 "id": "rcpt_...", "object": "route_receipt", "request_id": "req_...",
3 "requested_model": "deepseek-v4-flash", "served_model": "deepseek-v4-flash",
4 "surface": "chat_completions", "requested_contract": null, "contract_passed": false,
5 "state": "settled", "fallbacks_attempted": 0, "attempts_count": 1,
6 "request_transformed": true, "transformed_fields": ["model", "max_tokens"],
7 "usage": {"input_tokens": 123, "output_tokens": 45, "estimated": false},
8 "latency_ms": 812, "total_cost_usd": "0.000123456789",
9 "created_at": "2026-08-03T00:00:00.000000Z", "terminal_at": "2026-08-03T00:00:01.000000Z"
10}

Field glossary

  • state — the request’s lifecycle state; settled once billing is final.
  • served_model vs requested_model — what actually ran the request vs what you asked for. These differ on contract calls.
  • transformed_fields — which fields in your request the gateway modified or injected, such as an omitted output-limit field.
  • usage.estimatedtrue if token counts are estimated rather than exact.
  • total_cost_usd — the exact charge, as a 12-decimal string.
  • contract — present only on contract calls: {"slug": "...", "revision": 3}.

usage and total_cost_usd are null until the request reaches a terminal state.

Credits

Credits are prepaid. Buy them in the dashboard at https://app.singularityapi.dev via Stripe Checkout.

  • New accounts get a $1 signup grant.
  • Deposit-match promotion: purchases are matched 100% with promotional credit, capped at $1,000 lifetime per account.
  • Promotional credit is spent before paid credit, and can expire.

Reserve-then-settle

Each request reserves its maximum possible cost up front — computed from the model’s list price and the request’s token bounds — then settles to the exact amount at completion. The receipt’s total_cost_usd reflects the final, settled charge.

If you don’t have enough credit to cover the reservation, the request fails with 402 insufficient_credit. See Errors & Rate Limits for the full error envelope.

A price change never affects an in-flight or already-settled request.