UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

39 lines (38 loc) • 1.81 kB
/** * OpenAI-Compatible Proxy Routes * * Exposes OpenAI Chat Completions-compatible /v1/chat/completions endpoint. * ALL requests are routed through ctx.neurolink.stream() — no direct * HTTP calls to any upstream provider. * * This is a thin wrapper that parses OpenAI format requests and delegates * to the shared proxy translation engine. * * An optional ModelRouter can remap incoming model names to different * provider/model pairs (e.g. "gpt-4o" -> vertex/gemini-2.5-pro). */ import type { ModelRouterInterface, ProxyRuntimeConfigProvider, RouteGroup } from "../../types/index.js"; declare function resolveStreamCancellationLifecycle(terminalStreamError: string | undefined): { status: number; errorType: string; errorMessage: string; }; /** * Create OpenAI-compatible proxy routes. * * Every request flows through ctx.neurolink.stream() — no direct HTTP calls * to any upstream provider. * * @param modelRouter - Optional model router for remapping model names. * @param basePath - Base path prefix (default: ""). * @param loopbackPort - Listener port used by the Anthropic loopback bridge. * Defaults to the CLI proxy default (55669). MUST be the * actual listener port — never derived from request * headers — to avoid SSRF. * @returns RouteGroup with OpenAI-compatible endpoints. */ export declare function createOpenAIProxyRoutes(modelRouter?: ModelRouterInterface, basePath?: string, loopbackPort?: number, runtimeConfigProvider?: ProxyRuntimeConfigProvider, internalDispatch?: (request: Request) => Response | Promise<Response>): RouteGroup; export declare const __testHooks: { resolveStreamCancellationLifecycle: typeof resolveStreamCancellationLifecycle; }; export {};