LLMs
Language models (LLMs) registered with Foundation4, direct queries to a model and the OpenAI-compatible chat completions endpoint. LLMs describes the object type and the response formats.
List LLMs
Returns one page of the LLM registrations that the key can read, in the list envelope. Query parameters filter the list by field values and set the order and the page. The list has no filter on the model name.
Register an LLM
Registers a connection to a model server that exposes an OpenAI-compatible API. Foundation4 does not contact the model server during registration, so an incorrect endpoint or API key appears only when the LLM is first used. Foundation4 encrypts the API key before storage, and no response returns the key.
Get an LLM
Returns the registration of one LLM. The response never contains the API key of the registration.
Update an LLM
Changes the fields of an LLM registration that the request names, and keeps the stored value of every omitted field. A `null` value clears `description` or `api_key`, and a new `api_key` value replaces the stored key. Foundation4 does not contact the model server during the update.
Delete an LLM
Deletes an LLM registration. Agents store no LLM, so the deletion changes no agent. Agent executions and queries that name the deleted LLM then return HTTP 404.
Query an LLM
Sends `query` to the LLM as a single user message, without a system message or retrieval, and returns the generated answer. The `stream` field selects the response format: newline-delimited JSON (NDJSON) by default, server-sent events with `'sse'` or plain text with `false`. The direct query calls the Responses API of the model server, so the LLM registration requires an API key.
Relay a chat completion
Relays an OpenAI chat completion request to the chat completions API of the LLM named in the `x-llm-id` header. Foundation4 forwards the body unchanged, inserts the registered model name when the body has no `model` field and sends the API key of the registration, when the registration has one, as a bearer token. Foundation4 returns the model server's status and body, including error responses, and performs no retrieval, prompt templating or tracing.