From 9e397795885cdd13253b54a1d7df1233fb238524 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 2 Sep 2026 17:04:06 +0200 Subject: [PATCH 1/2] docs: document /v1/infer/batch + /v1/assets in docs page and OpenAPI --- src/docs.ts | 6 ++++++ src/openapi.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/docs.ts b/src/docs.ts index ff53c98..17446c5 100644 --- a/src/docs.ts +++ b/src/docs.ts @@ -14,6 +14,12 @@ const ENDPOINTS: { method: string; path: string; note: string }[] = [ { method: "GET", path: "/v1/models", note: "neural model index (IMF v1)" }, { method: "GET", path: "/v1/models/{id}", note: "one model's metadata" }, { method: "POST", path: "/v1/infer", note: "{model, input} → {output}" }, + { method: "POST", path: "/v1/infer/batch", note: "{model, inputs[]} → per-item results (≤50)" }, + { + method: "GET", + path: "/v1/assets/{tag}/{file}", + note: "CORS streaming proxy for release assets", + }, { method: "POST", path: "/graphql", note: "GraphQL endpoint (introspection enabled)" }, { method: "GET", path: "/openapi.json", note: "OpenAPI 3.1 document" }, ] diff --git a/src/openapi.ts b/src/openapi.ts index 67bebb3..7cb0b0b 100644 --- a/src/openapi.ts +++ b/src/openapi.ts @@ -116,6 +116,48 @@ export const OPENAPI = { }, }, }, + "/v1/infer/batch": { + post: { + tags: ["inference"], + summary: "Batch neural inference", + description: "Up to 50 inputs per request against one model; per-item error isolation.", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + properties: { + model: { type: "string" }, + inputs: { type: "array", items: { type: "string" }, maxItems: 50 }, + }, + required: ["model", "inputs"], + }, + }, + }, + }, + responses: { + "200": { description: "Per-item results" }, + "400": { $ref: "#/components/responses/BadRequest" }, + "404": { $ref: "#/components/responses/NotFound" }, + }, + }, + }, + "/v1/assets/{tag}/{file}": { + get: { + tags: ["maps"], + summary: "Release asset (CORS proxy)", + description: "Streaming pass-through to GitHub Releases assets with permissive CORS.", + parameters: [ + { name: "tag", in: "path", required: true, schema: { type: "string" } }, + { name: "file", in: "path", required: true, schema: { type: "string" } }, + ], + responses: { + "200": { description: "Asset bytes" }, + "404": { $ref: "#/components/responses/NotFound" }, + }, + }, + }, "/v1/infer": { post: { tags: ["inference"], From d748201a5c43e5f10c7633ec5c6c51deb90ca046 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 2 Sep 2026 17:18:09 +0200 Subject: [PATCH 2/2] fix: add the BadRequest response component the new endpoints ref --- src/openapi.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/openapi.ts b/src/openapi.ts index 7cb0b0b..dcb6429 100644 --- a/src/openapi.ts +++ b/src/openapi.ts @@ -267,6 +267,10 @@ export const OPENAPI = { description: "Success", content: { "application/json": { schema: { type: "object" } } }, }, + BadRequest: { + description: "Malformed request", + content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } }, + }, NotFound: { description: "Unknown system or model", content: { "application/json": { schema: { $ref: "#/components/schemas/Error" } } },