Eridian

TypeScript SDK

@eridian/sdk for Node and TypeScript services.

@eridian/sdk is the official TypeScript client for Node 18+ and ESM runtimes. It targets https://api.geteridian.com/v1 and types the eridian metadata block on every inference response.

Install

npm install @eridian/sdk
pnpm add @eridian/sdk

Client

import { Eridian } from "@eridian/sdk";

const client = new Eridian({
  apiKey: process.env.ERIDIAN_API_KEY!,
  projectId: "prj_legal_001",
  timeout: 30_000,
  maxRetries: 3,
});

ERIDIAN_API_KEY and ERIDIAN_PROJECT_ID are read if the constructor fields are omitted. Keys must use the eridian_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; // "eridian.inference.response"
response.eridian.route; // "gpt" | "gemini"
response.eridian.costUsd;
response.eridian.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 { Eridian, EridianError, RateLimitError } from "@eridian/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 EridianError) {
    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 eridian_sk_ values to browsers.

OpenAI adapter

If a dependency must keep the OpenAI client, set baseURL to https://api.geteridian.com/v1 and pass project_id. You lose typed eridian fields. Prefer @eridian/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.