TypeScript SDK
There are two supported paths in TypeScript. Lead with the stock SDKs; reach for the branded wrapper when you want the ergonomics.
Option 1 — stock SDKs (zero new deps)
Section titled “Option 1 — stock SDKs (zero new deps)”import OpenAI from 'openai';const client = new OpenAI({ baseURL: 'https://api.opengateway.one/oss/v1', // includes /v1 apiKey: process.env.OPENGATEWAY_API_KEY,});import Anthropic from '@anthropic-ai/sdk';const anthropic = new Anthropic({ baseURL: 'https://api.opengateway.one/oss', // NO /v1 apiKey: process.env.OPENGATEWAY_API_KEY,});See OpenAI & Anthropic SDKs for full snippets.
Option 2 — the branded opengateway wrapper
Section titled “Option 2 — the branded opengateway wrapper”npm install opengatewayOpenGateway extends the stock OpenAI client — so every endpoint works with
the base URL/lane/auth preconfigured — and adds an Anthropic client, model-alias
resolution, and one normalized effort knob. It wraps, never forks.
import { OpenGateway } from 'opengateway';
const og = new OpenGateway({ apiKey: process.env.OPENGATEWAY_API_KEY }); // lane: 'oss'
// Chat sugar: friendly alias + normalized effort.const res = await og.complete({ model: 'qwen3-coder', // → claude-turbo-hub-qwen3-coder effort: 'high', // → reasoning_effort: 'high' messages: [{ role: 'user', content: 'Refactor this function.' }],});console.log(res.choices[0]?.message?.content);The full stock OpenAI surface is inherited (base URL baked in):
await og.responses.create({ model: 'claude-turbo-hub-gpt-oss-120b', input: 'hi' });await og.embeddings.create({ model: 'Qwen/Qwen3-Embedding-0.6B', input: 'hi' });await og.models.list();Anthropic Messages on the same gateway/lane (base URL omits /v1):
await og.anthropic.messages.create({ model: 'claude-turbo-hub-qwen3-coder', max_tokens: 256, messages: [{ role: 'user', content: 'Review this diff.' }],});Options
Section titled “Options”| Option | Default | Notes |
| --- | --- | --- |
| apiKey | process.env.OPENGATEWAY_API_KEY | Required. |
| lane | 'oss' | oss / hf / frontier / pro. |
| host | https://api.opengateway.one | PREVIEW_HOST for preview. |
| baseURL | computed | Override the OpenAI base URL. |
| defaultHeaders | — | Sent on every request. |
Helpers
Section titled “Helpers”import { openAIBaseUrl, // → .../oss/v1 (includes /v1) anthropicBaseUrl, // → .../oss (no /v1) resolveAlias, // 'qwen3-coder' → 'claude-turbo-hub-qwen3-coder' toReasoningEffort, // 'max' → 'xhigh' toAnthropicEffort, // 'high' → { thinking, output_config } OpenAI, Anthropic, // stock clients, re-exported} from 'opengateway';Ask about configuring OpenGateway — lanes, base URLs, client setup, model choice, or an error you hit. Answers are grounded in the docs.