@razroo/ray-sdk
v0.3.0
Published
TypeScript client for the Ray inference gateway HTTP API
Downloads
15
Maintainers
Readme
@razroo/ray-sdk
Minimal TypeScript client for the Ray inference gateway HTTP API.
Install
bun add @razroo/ray-sdkRequires @razroo/ray-core (installed automatically as a dependency).
Usage
import { RayClient } from "@razroo/ray-sdk";
const client = new RayClient({
baseUrl: "http://127.0.0.1:3000",
apiKey: process.env.RAY_API_KEY,
timeoutMs: 60_000,
responseBodyLimitBytes: 2 * 1024 * 1024,
});
const result = await client.infer({
input: "Hello.",
seed: 17,
});
const job = await client.createJob({
input: "Draft a short follow-up email body.",
seed: 17,
stop: ["\n\n"],
});
const finalJob = await client.job(job.id);
const readiness = await client.readyz();Pass callbackUrl only when it points to an endpoint you operate.
Use readyz() for the unauthenticated minimal readiness payload and health() for the detailed protected health snapshot. See the gateway routes under apps/gateway and shared types in @razroo/ray-core for request and response shapes.
timeoutMs defaults to 60000, and responseBodyLimitBytes defaults to 2097152. SDK requests do not follow redirects, custom headers cannot override request framing or encoding headers, successful responses must use application/json or application/*+json, JSON error response messages omit stack fields, and oversized bodies are rejected before parsing.
