TypeScript SDK
@sallines/sdk for Node and TypeScript services.
@sallines/sdk is the official TypeScript client for Node 18+ and ESM runtimes. It targets https://api.sallines.world/v1 and types the sallines metadata block on every inference response.
Install
npm install @sallines/sdk
pnpm add @sallines/sdk
Client
import { Sallines } from "@sallines/sdk";
const client = new Sallines({
apiKey: process.env.SALLINES_API_KEY!,
projectId: "prj_legal_001",
timeout: 30_000,
maxRetries: 3,
});
SALLINES_API_KEY and SALLINES_PROJECT_ID are read if the constructor fields are omitted. Keys must use the sallines_sk_ prefix.
Inference
const response = await client.inference.create({
model: "auto",
messages: [{ role: "user", content: "Summarize termination risk." }],
features: ["pii_redaction", "semantic_cache"],
idempotencyKey: "contract-summary-4821-v1",
});
response.object; // "sallines.inference.response"
response.sallines.route; // "gpt" | "gemini"
response.sallines.costUsd;
response.sallines.region;
Streaming
const stream = await client.inference.stream({
model: "auto",
projectId: "prj_legal_001",
messages: [{ role: "user", content: "Draft the notice." }],
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content;
if (delta) process.stdout.write(delta);
}
Errors
import { Sallines, SallinesError, RateLimitError } from "@sallines/sdk";
try {
await client.inference.create({
model: "auto",
messages: [{ role: "user", content: "Hello" }],
});
} catch (error) {
if (error instanceof RateLimitError) {
console.error(error.requestId, error.resetAt);
} else if (error instanceof SallinesError) {
console.error(error.code, error.status);
}
throw error;
}
Edge runtimes
The SDK uses fetch. It runs on Node 18, recent Cloudflare Workers, and Vercel Functions. Supply apiKey from the platform secret store. Do not ship sallines_sk_ values to browsers.
OpenAI adapter
If a dependency must keep the OpenAI client, set baseURL to https://api.sallines.world/v1 and pass project_id. You lose typed sallines fields. Prefer @sallines/sdk for new services.
See SDKs, Python SDK, and Go SDK.
Production API credentials are issued with an institution workspace. Contact sales if you need access.