LM-Kit OneDocs2026.11.1lm-kit.comEULA
Integration

Responses and Vector Stores

The newest agentic clients no longer speak plain chat completions: they speak the OpenAI Responses API, a stateful protocol where the server stores each turn and the client chains on it. This server serves that protocol at POST /v1/responses, alongside the file surface and vector stores that ground it, so a tool built for it (Codex-class clients configure wire_api = "responses" and a base URL) runs here unmodified, with every turn generated and stored locally.


1The response lifecycle#

A response is stored by default (store defaults to true) and becomes an address:

Call What it does
POST /v1/responses Generates a response and stores it
POST /v1/responses with previous_response_id Continues from a stored response without resending the transcript
GET /v1/responses/{id} Retrieves a stored response
GET /v1/responses/{id}/input_items Lists the input a stored response was given
DELETE /v1/responses/{id} Removes it

Chaining follows the upstream contract exactly, including its sharp edge: instructions are NOT inherited across previous_response_id, so a client that relies on per-turn instructions must send them each turn. Stored responses are per-key, like files and everything else here (Keys and Authentication).

2What a request can carry#

Input is a string or an item array, and the item vocabulary is served broadly:

  • Messages with input_text, input_image (a data URL, an http or https URL, or an uploaded file_id), and input_file (a file_id or inline file_data); document text is folded into the model's context.
  • Function tools, flat, with tool_choice; function_call and function_call_output items round-trip the loop.
  • Structured output through text.format: json_object and json_schema are enforced with grammar-constrained decoding, so the model cannot produce anything but the shape you declared.
  • Reasoning: thinking models return real reasoning output items, reasoning items pass through on input, and usage carries a reasoning-token breakdown.
  • A named agent, as an LM-Kit extension: agent adopts a server-defined agent (its prompt ahead of your instructions, its skill, server tools under your key's grants, memory, knowledge sources and model pin), resolved exactly as on chat completions; explicit fields win. skill, server_tools, memory and memory_store state those assets directly, user keeps memory per end user, and an agent grounded in knowledge sources returns grounding on the response (on response.completed when streaming). Like instructions, an agent is not inherited through previous_response_id: state it on every request.

The grounding loop is three calls and one tool:

  1. POST /v1/files uploads the document (GET /v1/files/{id} reads its metadata back, GET /v1/files lists the key's uploads, DELETE /v1/files/{id} removes one).
  2. POST /v1/vector_stores creates a store; GET lists or retrieves; DELETE removes a store and everything indexed in it.
  3. POST /v1/vector_stores/{id}/files attaches an uploaded file. The document is full-text searchable immediately and becomes semantically searchable when its embedding pass completes, so grounding works the moment the call returns and gets better seconds later. GET .../files/{file_id} reports the status (in_progress until the embedding pass lands, then completed), which is what SDK create-and-poll helpers wait on; GET .../files lists the store's files with the same status, and DELETE .../files/{file_id} detaches one without touching the upload itself.
  4. Declare the file_search tool on the request, on POST /v1/responses or on POST /v1/chat/completions: both run it. The search executes server-side over your stores; there is deliberately no standalone store-query route, so retrieval always happens inside a generation, where the results land in context.

Vector stores are collections on the server's default Search cluster under a per-key tenant, so the key needs a grant on that cluster (the create dialog grants the default cluster; a key minted without Search access is refused with a 403 that says so), and they follow that cluster's engine: fleet-wide when the cluster runs on an external engine, one node's file when it is the embedded default (Storage Engines and Deployment). For retrieval you control call-by-call (hybrid tuning, filters, reranking, facets), the Search engine is the richer surface; vector stores are the compatibility path that makes existing OpenAI-style agents work as-is.

4Streaming#

Streaming responses follow the documented event scaffold with a monotonic sequence_number: response.created, response.in_progress, response.output_item.added, response.content_part.added, response.output_text.delta (repeated), response.output_text.done, response.content_part.done, response.output_item.done, response.completed. Clients that reconstruct state from events see the shape they were written against.

background: true answers at once with the stored response in status queued and generates it on the server: poll GET /v1/responses/{id} until its status is completed, failed, incomplete or cancelled, and stop it with POST /v1/responses/{id}/cancel from any node. A background response is always stored, and is not streamed. When the node generating it stops, the response ends failed with the code interrupted instead of staying in progress: send the request again. For agent work that must survive restarts and wait for people, use durable agent runs.

5Refused by name, never approximated#

Serving a stateful protocol approximately corrupts the caller's conversation, so what this version does not serve answers as a precise 400 naming the field: conversation objects (resend the transcript as input items), streaming a background response, hosted tool types other than file_search, and item_reference. A client learns exactly what to change instead of debugging a silent misinterpretation.

6Stated plainly#

  • wire_api = "responses" plus a base URL pointing here runs Responses-native tooling on local models: stateful turns, tools, structured output, reasoning, streaming.
  • Files plus vector stores plus file_search give OpenAI-style grounding without a byte leaving this server; the Search engine remains the deeper retrieval surface when you want the knobs.
  • Storage is per-key and deletable; chaining does not inherit instructions, by contract.
  • Unsupported protocol corners are refused by name, so failures are actionable.