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.
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,
});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
Chat Completions
Keep the standard messages format when integrating an existing OpenAI-compatible application.
Responses API
Build stateful model interactions with persistent conversations and hosted tools.
Autofix API
Fix invalid OpenUI Lang from any model. Send the raw generation and get back valid OpenUI Lang.
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.
- Correction on its own. Keep your model and backend, and send only the generation that needs fixing to the Autofix API.
- 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).