@xsai/shared

v1.0.0-beta.10

Published

extra-small AI SDK: shared utilities for xsAI packages.

Readme

@xsai/shared

pnpm add @xsai/shared
import { HttpError, sendRequest } from '@xsai/shared'

try {
  await sendRequest({ method: 'GET', path: 'models' }, {
    baseURL: 'https://example.com/v1/',
    fetch: async () => new Response('Try again later', { status: 429 }),
  })
}
catch (error) {
  if (HttpError.isInstance(error))
    console.log(error.status, error.body)
  else
    throw error
}

Read the documentation.