Orux AIOruxAI

Building a Chat Assistant on One OpenAI-Compatible API

GPT-6.1 and Claude Opus 5.5 through one endpoint: SDK setup in five lines, model selection by price, and honest failure handling for 401/402/429.

openai compatible chat api
gpt-6.1-solclaude-opus-5-5

What you'll build

A chat completion call against one OpenAI-compatible endpoint — the base of support bots, copilots and content tools. Because Orux AI is OpenAI-compatible, your existing OpenAI SDK works by changing the base URL.

1. Point your SDK at Orux

import OpenAI from "openai"

const client = new OpenAI({
  baseURL: "https://orux.top/api/v1",
  apiKey: process.env.ORUX_API_KEY,
})

const res = await client.chat.completions.create({
  model: "gpt-6.1-sol",
  messages: [{ role: "user", content: "Explain database indexes to a junior dev." }],
})

console.log(res.choices[0].message.content)

No SDK rewrite, no second account. Switching models is changing the model string.

2. Pick the model for the job

ModelVendorInput (Cr / 1M tok)Output (Cr / 1M tok)
gpt-6.1-solOpenAI22.06110.31
claude-opus-5-5Anthropic105.89529.44

Rule of thumb: route most traffic to the cost-efficient model and reserve the flagship for the hard turns — you can do this in code with a one-line fallback list, since every model shares the same request shape.

3. Handle failures honestly

  • 401 — key invalid or revoked;
  • 402 — balance exhausted (distinct from auth failures; handle it as a top-up flow, not a bug);
  • 429 — rate limited: back off and retry with jitter;
  • Network timeout — safe to retry only if you did not receive a response body; otherwise you may double-bill tokens.

4. Cost visibility

Every call's credit cost is recorded and visible in the usage view per model and per day — so unit economics stay measurable as you scale.

Next steps

Try both flagships in their Playgrounds before writing code, add streaming (stream: true works the same as OpenAI), and check the pricing page for the full rate table.

← All use cases