OpenUI Gateway

OpenUI Gateway provides a unified API to access models across different providers through a single endpoint. It adds reliability to OpenUI Lang generation with automatic failover and model-output correction.

server.ts
import OpenAI from "openai";

const gateway = new OpenAI({
  apiKey: process.env.THESYS_API_KEY,
  baseURL: "https://api.thesys.dev/v1/embed",
});

const completion = await gateway.chat.completions.create({
  model: "openai/gpt-5",
  messages: [
    { role: "user", content: "Compare quarterly revenue by region." },
  ],
  stream: true,
});
server.ts
import OpenAI from "openai";

const gateway = new OpenAI({
  apiKey: process.env.THESYS_API_KEY,
  baseURL: "https://api.thesys.dev/v1/embed",
});

const response = await gateway.responses.create({
  model: "openai/gpt-5",
  input: "Compare quarterly revenue by region.",
  stream: true,
});

Choose an API

What OpenUI Gateway provides

  • Validated generated UI. Validates generated UI during the stream and fixes malformed syntax, invalid component usage, and schema violations before forwarding the response.
  • Unified API. Switch between providers and models with minimal code changes.
  • High reliability. Automatically retries requests with other providers if one fails.
  • No markup on tokens. Tokens cost the same as they would from the provider directly, with zero markup, including with Bring Your Own Key (BYOK).