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.

Introduction

Quickstart

Install the SDK, grab a key, and make your first request in about five minutes.

1. Install the SDK

terminal
npm install @openlink/sdk

The SDK supports Node 18 and later, and ships its own type definitions for TypeScript.

2. Get an API key

Keys are created from the dashboard under API Keys → Create key. Keys start with sk_. Store it in your environment, never in source code.

.env
OPENLINK_API_KEY=sk_live_your_key_here

Beta keys

During beta every key has the same scope. Scoped keys — read-only, per-provider, per-environment — arrive with the v1.1 release.

3. Make your first request

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

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

const response = await client.chat({
  messages: [
    { role: "user", content: "What is the capital of India?" },
  ],
});

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

Run it: npx tsx chat.ts. No provider is named — the gateway routes the request itself.

4. Read the response

JSON
{
  "id": "chatcmpl_01J8R2aKq...",
  "object": "chat.completion",
  "created": 1758432000,
  "model": "claude",
  "provider": "anthropic",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "The capital of India is New Delhi." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 8, "total_tokens": 20 }
}
  • model and provider tell you who answered.
  • usage is token counts across the whole request, whichever provider served it.
  • The shape is stable across every provider.

Next steps