Unispec Docs
ApiAgents

OpenAI-compatible chat completions

Point any OpenAI client at Libra: `model` is the **agent name** (a `libra:` prefix is tolerated), auth accepts `Bearer`. The full server-side pipeline (rules, guardrails, tools/flow, risk-hold) runs on every request; client `system` messages are ignored (the agent owns its instructions). With `stream: true` the response is `text/event-stream` of `chat.completion.chunk` events terminated by `data: [DONE]`. Default mode is **buffer-then-stream** (pipeline completes, approved answer replays as chunks); agents with `stream_mode: "live"` stream tokens as generated when the guard gate allows (output guard off, no tools/flow). Typed extras (`ui_actions`, `citations`, `escalated`) ride in a non-standard `x_libra` field on the final chunk / completion object.

POST
/v1/chat/completions

Point any OpenAI client at Libra: model is the agent name (a libra: prefix is tolerated), auth accepts Bearer. The full server-side pipeline (rules, guardrails, tools/flow, risk-hold) runs on every request; client system messages are ignored (the agent owns its instructions).

With stream: true the response is text/event-stream of chat.completion.chunk events terminated by data: [DONE]. Default mode is buffer-then-stream (pipeline completes, approved answer replays as chunks); agents with stream_mode: "live" stream tokens as generated when the guard gate allows (output guard off, no tools/flow). Typed extras (ui_actions, citations, escalated) ride in a non-standard x_libra field on the final chunk / completion object.

Authorization

TokenAuth
Authorization<token>

Project API key as Token lb-sk_...

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "messages": [      {        "role": "user",        "content": "string"      }    ]  }'
{  "id": "string",  "object": "chat.completion",  "created": 0,  "model": "string",  "choices": [    {      "index": 0,      "message": {        "role": "user",        "content": "string"      },      "finish_reason": "string"    }  ],  "usage": {    "prompt_tokens": 0,    "completion_tokens": 0,    "total_tokens": 0  },  "x_libra": {}}
Empty
Empty