Docs / Quickstart

Quickstart

OpenGateway is a base-URL swap. Bring your existing OpenAI or Anthropic client, authenticate with a single OpenGateway key, and call curated open-weight models on /oss.

1. Set your API key

bash
export OPENGATEWAY_API_KEY="YOUR_KEY"

Send it as Authorization: Bearer $OPENGATEWAY_API_KEY (OpenAI style) or x-api-key: $OPENGATEWAY_API_KEY (Anthropic style). Both work on every route. Never send upstream provider keys.

2. Pick the right base URL

ClientBase URL
OpenAI SDK, Codex, Cursorhttps://api.opengateway.one/oss/v1
Anthropic SDK, Claude Code (CLI/IDE/Desktop)https://api.opengateway.one/oss

3. Make your first request

curl
curl "https://api.opengateway.one/oss/v1/chat/completions" \
  -H "Authorization: Bearer $OPENGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [{ "role": "user", "content": "Say PONG only." }]
  }'
python · openai sdk
from openai import OpenAI

client = OpenAI(
    base_url="https://api.opengateway.one/oss/v1",  # includes /v1
    api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
    model="glm-5.2",
    messages=[{"role": "user", "content": "Say PONG only."}],
)
print(resp.choices[0].message.content)
typescript · openai sdk
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.opengateway.one/oss/v1", // includes /v1
  apiKey: process.env.OPENGATEWAY_API_KEY,
});
const resp = await client.chat.completions.create({
  model: "moonshotai/Kimi-K2.7-Code:preferred",
  messages: [{ role: "user", content: "Say PONG only." }],
});
console.log(resp.choices[0]?.message?.content);
typescript · anthropic sdk
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.opengateway.one/oss", // NO /v1 — SDK appends it
  apiKey: process.env.OPENGATEWAY_API_KEY,
});
const msg = await client.messages.create({
  model: "glm-5.2",
  max_tokens: 256,
  messages: [{ role: "user", content: "Write a TS debounce helper." }],
});
console.log(msg.content);
Model ids, two ways

Use a friendly open-model id like glm-5.2 (GLM 5.2) or kimi-k2.6 (Kimi K2.6), or a raw catalog id with a routing policy like zai-org/GLM-5.2:preferred or moonshotai/Kimi-K2.7-Code:preferred. Both resolve to the same open-weight model. See Model discovery.

Routing suffixes

Append a policy to any raw model id to control provider selection:

  • :preferred — the gateway's balanced default route
  • :fastest — lowest-latency live provider
  • :cheapest — lowest-cost live provider
text
Qwen/Qwen3-Coder-480B-A35B-Instruct:fastest
openai/gpt-oss-120b:cheapest
MiniMaxAI/MiniMax-M3:preferred

4. Point your coding agent

Jump to a client guide for copy-paste config: Claude Code (CLI, IDE, Desktop), Cursor, or Codex.

Discover models

curl · /oss/v1/models
curl "https://api.opengateway.one/oss/v1/models" \
  -H "Authorization: Bearer $OPENGATEWAY_API_KEY"

See Model discovery for the dual-shape response and how each client uses it, or browse the live model catalog.