HomeDocssdk/typescript
Gateway Protocol v1 · Production Reference

Documentation

One key, two compatible wire protocols, 15 frontier models. Read the quickstart or explore the API reference.

TypeScript SDK

Same shape as Python: install the official vendor SDK and point its baseURL at the gateway. Streaming and tool use work on both flavours, and the base URL differs by flavour — Anthropic gets the bare origin, OpenAI gets origin plus /v1.

Anthropic Wire Protocol

Anthropic

Base URL

https://api.selora.lol
SDK automatically appends /v1/messagesAuthenticate via x-api-key: sk-gw-...

OpenAI Wire Protocol

OpenAI

Base URL

https://api.selora.lol/v1
SDK automatically appends /chat/completionsAuthenticate via Authorization: Bearer sk-gw-...

Protocol Header Resolution: The gateway inspects x-api-key first and falls back to Authorization: Bearer. Both wire formats accept standard sk-gw-... gateway keys. Notice that the Anthropic URL is the bare origin (because official Anthropic SDKs append /v1/messages), while OpenAI tooling takes .../v1 (because OpenAI SDKs append /chat/completions).

Anthropic flavour — npm install @anthropic-ai/sdk
typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.SELORA_API_KEY,     // sk-gw-…, sent as x-api-key
  baseURL: "https://api.selora.lol",           // origin only — no /v1
});

const message = await client.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 512,                        // required on /v1/messages
  messages: [{ role: "user", content: "Write a short plan to back up a repo." }],
});
console.log(message.content);
OpenAI flavour — npm install openai
typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.SELORA_API_KEY,     // sk-gw-…, sent as Authorization: Bearer
  baseURL: "https://api.selora.lol/v1",         // origin + /v1
});

const completion = await client.chat.completions.create({
  model: "kimi-k3",
  messages: [{ role: "user", content: "Write a short plan to back up a repo." }],
});
console.log(completion.choices[0].message.content);

Both packages type the success shape and the error statuses, so a 429 or a 504 arrives as a typed exception you can branch on instead of parsing a body.