Introduction
Quickstart
Install the SDK, grab a key, and make your first request in about five minutes.
1. Install the SDK
npm install @openlink/sdkThe 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.
OPENLINK_API_KEY=sk_live_your_key_hereBeta 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
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
{
"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 }
}modelandprovidertell you who answered.usageis token counts across the whole request, whichever provider served it.- The shape is stable across every provider.
Next steps
- Send requests in real time with Streaming.
- Understand how requests are routed.
- Read the Chat Completions reference.