SDK
A typed TypeScript client for the public API. It adds idempotency keys, parses the error envelope, and types every response.
Not published yet
The SDK is being built in this repository and is not on npm yet. Until it ships, call the REST API directly (see the quickstart); the surface below is the planned one.
Install
bash
npm install @local/sdkUse
ts
import { Local, ApiError } from '@local/sdk'
const local = new Local({ apiKey: process.env.LOCAL_API_KEY!, baseUrl: 'https://api.uselocal.sh' })
const quote = await local.quotes.create({ tool: '{provider}/{slug}', input: { /* … */ } })
console.log(quote.is_ceiling ? `Maximum charge: $${quote.amount_usd}` : `Charge: $${quote.amount_usd}`)
try {
const result = await local.tools.execute('{provider}/{slug}', { input: { /* … */ }, quoteId: quote.quote_id })
console.log(result.billing.charged_usd, result.data)
} catch (e) {
if (e instanceof ApiError && e.code === 'insufficient_balance') {
// Add funds to continue making requests.
}
throw e
}Idempotency
The SDK generates an Idempotency-Key per call and reuses it on its own retries. Pass idempotencyKey explicitly when you manage retries yourself.
Surface
catalog.list / providers / tool,quotes.create,tools.execute,rpc.solanajobs.list / get / result / cancel,usage.list / request,balance.getkeys.*,deposits.*,webhooks.*for management scopes
The SDK package is published from this repository; its exact exports are the authority when they differ from this summary.