Beta docs: the shipped API is POST /api/v1/generate for gemini and sarvam. Some pages below describe planned features. See the shipped quick start.

SDK

JavaScript SDK

The same client, plain JavaScript — CommonJS and ESM.

The SDK ships both ESM and CommonJS builds. Type annotations are included either way, so editors still offer autocomplete in plain .js files.

CommonJS

chat.cjs
const { OpenLink } = require("@openlink/sdk");

const client = new OpenLink({ apiKey: process.env.OPENLINK_API_KEY });

(async () => {
  const response = await client.chat({
    messages: [{ role: "user", content: "Hi from CommonJS" }],
  });

  console.log(response.choices[0].message.content);
})();

ESM

chat.mjs
import { OpenLink } from "@openlink/sdk";

const client = new OpenLink({ apiKey: process.env.OPENLINK_API_KEY });

const response = await client.chat({
  messages: [{ role: "user", content: "Hi from ESM" }],
});

console.log(response.choices[0].message.content);

Browser usage

Keep keys out of browsers

The SDK works in Node and edge runtimes. Use it in a browser only behind your own proxy — an exposed OPENLINK_API_KEY is a spending liability.