@unprice/api to put the customer money path inside your server request path: create or map a
customer, check access, consume usage, reserve budgeted runs, inspect wallet credits, and explain
usage or ingestion evidence.
The SDK returns typed results instead of throwing for expected API errors, so every request has an
explicit result or error branch.
Install
Unprice API key
Create a project API key in the project settings, then provide it to the client from server-side code:First runtime call
For a read-only shadow check:Response format
Every method returns either anerror or a result field, never both and never neither.
Checking for errors
Check theerror property before using result. API errors include a docs link and request ID for
support lookup.
Options
The constructor accepts some options to customize the behavior:Base Url
Run all requests against your own Unprice instance.string
default:"https://api.unprice.dev"
Retries
By default the client will retry on network errors, you can customize this behavior:Cache
Configure thefetch cache behavior.
string
Available options are:
default, force-cache, no-cache, no-store, only-if-cached or reload.