Every gate in this repo compares a client to the document, and every build proves the client is well-formed. Neither answers the question a user actually has: does it work against a server. Seven languages now answer it -- go, python, typescript, dart, php, ruby, rust -- against the local cloud by default and against anything HANZO_BASE_URL names. Each probe asserts a 200 whose body decodes AND a 403 that arrives as an error, because a client that swallows a refusal and returns a zero value looks exactly like one that works. It earned its place on the first run: GET /v1/models is AiAPI.GetModels in Go and ai_api::get_models in Rust but ModelsApi.getModels in TypeScript. One document, three groupings, and nothing but a call finds it.
21 lines
830 B
JavaScript
21 lines
830 B
JavaScript
const h = require('hanzoai');
|
|
(async () => {
|
|
const base = process.env.HANZO_BASE_URL;
|
|
const cfg = new h.Configuration({ basePath: base });
|
|
let fail = 0;
|
|
try {
|
|
const r = await new h.ModelsApi(cfg).getModels();
|
|
const n = (r.data && r.data.data) ? r.data.data.length : 0;
|
|
console.log(` ok GET /v1/models ${r.status}, ${n} models`);
|
|
} catch (e) { console.log(' FAIL models:', e.message.slice(0,70)); fail++; }
|
|
try {
|
|
await new h.EngineApi(cfg).engineStatus();
|
|
console.log(' FAIL engine: unauthenticated call reported success'); fail++;
|
|
} catch (e) {
|
|
const code = e.response ? e.response.status : e.code;
|
|
console.log(` ok GET /v1/engine/status refused: ${code}`);
|
|
}
|
|
console.log(fail === 0 ? 'PASS typescript' : `FAIL typescript (${fail})`);
|
|
process.exit(fail === 0 ? 0 : 1);
|
|
})();
|