SDKs

TypeScript SDK

@ourseams/sdk. one namespace per CLI command group.

cli
npm install @ourseams/sdk

Types come from the OpenAPI document via openapi-typescript, and the calls go through openapi-fetch. Nothing is hand-written, so a method that compiles is a route that exists.

Constructing it

typescript
import { Seams } from "@ourseams/sdk"

const seams = new Seams({ apiKey: process.env.SEAMS_API_KEY! })
OptionDefaultFor
apiKeyrequiredYour sk_ customer token
baseUrlhttps://api.ourseams.comPointing at a local quickstart
fetchglobalThis.fetchTests, or a fetch with your own retries

It is a named export, not a default one. import Seams from "@ourseams/sdk" does not work.

Shape of a call

Path parameters are positional, bodies and queries are objects. The method name is the operation id, which is the CLI command with a dot in it.

typescript
await seams.users.create("alice", { email: "[email protected]", bundle: "pro" })

const key = await seams.keys.mint({ endUserId: "alice", bundle: "pro" })
await seams.keys.cap(key.id, { capMicros: "5000000" })

const { rows, totals } = await seams.usage({ endUserId: "alice" })
const { url } = await seams.portal.link({ externalId: "alice" })

A call resolves to the response body, already unwrapped. There is no envelope to reach through and no .data to remember.

Errors

Any non-2xx throws a SeamsError carrying the HTTP status and the platform's machine-readable code. Switch on the code, never on the message.

typescript
import { Seams, SeamsError } from "@ourseams/sdk"

try {
  await seams.keys.mint({ endUserId: "alice", bundle: "pro" })
} catch (error) {
  if (error instanceof SeamsError && error.code === "invalid_api_key") {
    // rotate, or fail the deploy
  }
  throw error
}

Money

Every amount is an integer count of micro-dollars, carried as a string so it survives JSON. Convert at the edge, and do the arithmetic in BigInt.

typescript
const micros = BigInt(totals.billedMicros)
const usd = (Number(micros) / 1_000_000).toFixed(2)

The gateway is not this client's job. Inference goes through an OpenAI, Anthropic, or Gemini client pointed at your gateway host; this package administers the account.