Tailrace
Reference

Express

Reference for @tailrace/express - tailraceExpress middleware and TailraceExpressOptions.

@tailrace/express provides OpenAI-compatible passthrough middleware for Express. It scans chat request bodies and JSON / SSE responses at the model boundary.

Install

pnpm add @tailrace/core @tailrace/express express

Peer dependency: express >=4. Depends on @tailrace/core + @tailrace/http.

Exports

ExportDescription
tailraceExpressReturns Express request middleware
TailraceExpressOptionsOptions type

Options

OptionDefaultNotes
mode"openai-compatible"Only mode in v0.1
agent"default"(req) => string
workflowId"default"string or (req) => string
onDecision-Audit callback

Expects a JSON body (express.json() or equivalent) for chat requests. Boundary provider is the request body's model string as-is (no ${providerId}/${modelId} rewrite).

Block shape

422 JSON { error: { type: "policy_violation", entity, rule } }. SSE: one data: error event then close (abort-equivalent only). Maps from PolicyViolationError.

See also

On this page