# Hono

URL: https://tailrace.dev/docs/reference/hono

> Reference for @tailrace/hono - tailraceHono middleware and TailraceHonoOptions.



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

## Install [#install]

```bash
pnpm add @tailrace/core @tailrace/hono hono
```

Peer dependency: `hono` `>=4` (bound against `4.12.x` `MiddlewareHandler` / `Context`).

## Exports [#exports]

| Export                | Description                        |
| --------------------- | ---------------------------------- |
| `tailraceHono`        | Returns a Hono `MiddlewareHandler` |
| `TailraceHonoOptions` | Options type                       |

## Options [#options]

| Option       | Default               | Notes                       |
| ------------ | --------------------- | --------------------------- |
| `mode`       | `"openai-compatible"` | Only mode in v0.1           |
| `agent`      | `"default"`           | `(c) => string`             |
| `workflowId` | `"default"`           | `string` or `(c) => string` |
| `onDecision` | -                     | Audit callback              |

Boundary provider is the request body's `model` string as-is (no `${providerId}/${modelId}` rewrite).

## Block shape [#block-shape]

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

## Guides [#guides]

* [Hono integration](/docs/integrations/hono)
* [Protect PII in the AI SDK](/docs/guides/protect-pii-in-ai-sdk)
