x-fal-billable-units header: WebSocket billing vs Sume receipts
fal bills WebSocket sessions via x-fal-billable-units headers. Sume has no such header: cost is a per-job ledger row you read back by job or run.

x-fal-billable-units is a header a fal WebSocket endpoint sets on its upgrade response to say how many units a session should be billed for. Sume has no equivalent header: you do not declare units, and cost is read back from the usage ledger per job or per run.
The fal side is from its changelog; the Sume side is from the API reference and core workflow, read 2026-10-01.
What does the fal changelog say about the header?
The entry is titled "Billing Headers for WebSocket Endpoints". Shared WebSocket endpoints can declare billing on their upgrade response. Set x-fal-billable-units when the unit count is known at connect time. Set x-fal-billable-units-webhook to 1 when the count is only known at the end of the session, then report the total with POST /requests/billable-units/{request_id}. Sessions without either header are still charged by duration.
Is there a billing header on Sume?
No header is documented. Sume jobs are submitted over HTTP, and the docs describe cost as ledger activity: provider-backed generation can reserve an estimated USD amount, capture the actual cost on success, and refund on failure or cancellation before capture.
| Question | fal WebSocket endpoint | Sume |
|---|---|---|
| Who states the unit count? | The endpoint, via header or end-of-session report | Not a caller input; the ledger records reserve, capture, refund |
| Where do I read the cost? | Per the changelog, reported to /requests/billable-units/{request_id} | GET /v1/usage and GET /v1/balance |
| What if the work fails? | Not stated in the entry | Refund on failure or cancellation before capture |
How do I read what a Sume job cost?
GET /v1/usage returns ledger entries such as reservations, captures, refunds and top-ups. Each public row carries a job_id, and the endpoint can be scoped by thread_id, run_id or job_id; the scoped answer sums every ledger row that scope caused. For Format runs, the receipt's usage.debited_usd_micros is the same fold, so the receipt and the ledger agree.
curl "https://api.sume.com/v1/usage?job_id=$JOB_ID" \
-H "Authorization: Bearer $SUME_API_KEY"What should I change when porting fal billing code?
Drop the unit-reporting step. Keep the job id from the create response, and reconcile spend by reading the ledger with that id. If you need a roll-up, see per-run usage or export usage to CSV.
Sources
Related posts
More in Developers
- fal error_type request_timeout: which Sume field to monitor
fal exposes error_type in the body and X-Fal-Error-Type as a header. Sume puts category, stage and code in the error body; the request id is also a header.
- x-fal-needs-retry header: what Sume uses to signal a retry
fal marks retryable errors with X-Fal-Needs-Retry. Sume signals retry through error category and code, retry-after on 429, and the same idempotency key.
- x-fal-no-retry header: safe retries with a Sume Idempotency-Key
fal retries queued requests; X-Fal-No-Retry turns that off. On Sume you keep retries and make them safe with an Idempotency-Key on every paid submit.
- FastMCP client auth: pass the Sume API key as a string
In FastMCP, pass your Sume API key as a plain string to auth, with no Bearer prefix. The client adds the header; send only one credential.
Written by Sume