stophy package gives you typed calls to Stophy from Node.js, Bun, Deno and the browser.
Make a call
No account, no key.Response
Response
success, data, creditsUsed and requestId. A list is in data.results.
Methods follow the endpoint id. google.search is stophy.google.search(...), and reddit.search is stophy.reddit.search(...). The inputs and results are typed, so a missing required field is a compile error. The API reference lists every endpoint.
Use a key
Without a key you can call the endpoints markedkeyless: true in the catalog, and you get the first page only. Every other call throws a StophyError with code unauthorized.
Set STOPHY_API_KEY and new Stophy() picks it up. Or pass it in:
new Stophy("your key") works too.
Find endpoints
Page through results
A list call returns one page. When there is more,data.cursor is set. Pass it back to get the next page. This needs a key.
page number instead, like google.search. See Page through results.
Handle errors
retryAfterSeconds set. A failed call costs nothing. See Errors for every code.
Options
Check your usage
These need a key.balanceMicros is your balance in millionths of a dollar. One credit is 1,500, so divide by 1,500 to get credits. See Usage and Logs.