skip to the page

@jam-overture/loom/openai-compatible

The model seam for a server that speaks the OpenAI-compatible chat API, such as vLLM or Ollama. Optional.

Everything below is exported from that import. The names, the signatures and the sentences are read from the package itself rather than written here, so this page says what the copy of Loom in your node_modules says — and it changes in the same pull request the code does.

3 exports, in 1 module. Generated from ./dist/interpretation/openai-compatible.d.ts, which is the declaration file this package publishes for @jam-overture/loom/openai-compatible. Each comment inside a declaration is shown as its first paragraph. The whole of it is in that file.

Nothing to install first. Everything this import loads arrives with @jam-overture/loom itself.

No import here has everything behind it. @jam-overture/loom/openai-compatible publishes 3 of the 2,237 names this package publishes. The other 2,234 are behind one of the 19 other imports, and not one of those imports publishes a single name this one does. The imports do not nest: a name that is not on this page is not a name that does not exist, and the search at the top of the page says which import it comes from.

Openai compatible

interpretation/openai-compatible

The adapter for any server that speaks the OpenAI-compatible chat API with JSON-schema replies: vLLM, llama.cpp's server, Ollama, and the hosted services that serve open models the same way. Like anthropic.ts it is an entry point of its own, not exported from the package root, and its whole job is translation.

CompatibleFetchtype

The part of fetch this adapter uses, so a host can hand it a guarded one and a test a stub.

type CompatibleFetch = (url: string, init: {
    readonly method: "POST";
    readonly headers: Readonly<Record<string, string>>;
    readonly body: string;
    readonly redirect: "error";
    readonly signal?: AbortSignal | null;
}) => Promise<{
    readonly status: number;
    readonly json: () => Promise<unknown>;
}>;

OpenAiCompatibleConfigtype

type OpenAiCompatibleConfig = {
    /** The server's API root, such as `https://models.example.com/v1`; `/chat/completions` is added. */
    readonly endpoint: string;
    /** Sent as a bearer token where the server asks for one. */
    readonly apiKey?: string | undefined;
    readonly fetch: CompatibleFetch;
};

openAiCompatibleModelClientfunction

Shown in use on Connecting a model — A model you host yourself

const openAiCompatibleModelClient: (config: OpenAiCompatibleConfig) => ModelClient