mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-03 13:22:12 +03:00
Merged via /merge-batch (v3.8.51 provenance sweep). Boarded and validated together with the batch's other retirement PRs in a combined worktree — full gate suite green. This PR's conflicts (against #11720's Designer retirement, both introducing a retirement-guard mechanism across executors/index.ts, executorProxy.ts, providers.ts, reservedProviderPrefixes.ts, auth.ts, chat.ts, chatHelpers.ts, model.ts) were reconciled by combining both guards at every chokepoint, with the shared reserved-prefix count recomputed (not guessed) at 400. Re-validated with this PR's own 72 node:test + 20 vitest focused tests, all passing, and pushed before merge. Thank you.
31 lines
896 B
JavaScript
31 lines
896 B
JavaScript
/**
|
|
* OmniRoute Quickstart — Node.js (axios)
|
|
* =======================================
|
|
* Run: npm install axios
|
|
* node nodejs_axios.js
|
|
*/
|
|
|
|
const axios = require("axios");
|
|
|
|
// Your local OmniRoute server — started with: npx omniroute
|
|
const API_URL = "http://localhost:20128/v1/chat/completions";
|
|
|
|
const headers = {
|
|
"Content-Type": "application/json",
|
|
Authorization: "Bearer dummy-key", // Any string works for free/keyless providers
|
|
};
|
|
|
|
const data = {
|
|
model: "auto", // Zero-config routing, works out of the box — no sign-up needed
|
|
stream: false,
|
|
messages: [{ role: "user", content: "Hello! What can you do?" }],
|
|
};
|
|
|
|
axios
|
|
.post(API_URL, data, { headers })
|
|
.then((res) => console.log(res.data.choices[0].message.content))
|
|
.catch((err) => {
|
|
console.error("Error:", err.message);
|
|
if (err.response) console.error("Server replied:", err.response.data);
|
|
});
|