> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blindsight.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Wire-compatible OpenAI Chat Completions proxy

> Body and response match `POST https://api.openai.com/v1/chat/completions`
verbatim. Blindsight scans both directions; the verdict either
forwards (allow), mutates content in place (redact), or returns
an OpenAI-shaped error (block).

**Streaming**: pass `stream=true` to receive Server-Sent Events.
The firewall scans the assembled response on a 250 ms / 80-char
cadence and emits `finish_reason: content_filter` mid-stream on
a block verdict.

**Headers**: `Authorization` is reserved for OpenAI and forwarded
upstream untouched. Authenticate to Blindsight via `X-API-Key`.




## OpenAPI

````yaml /api-reference/openapi-runtime-security.yaml post /api/runtime-security/proxy/openai/v1/chat/completions
openapi: 3.1.0
info:
  title: Blindsight Runtime Security API
  version: 1.0.0
  summary: LLM firewall — prompt-injection, PII, and agent tool-call protection.
  description: |
    Drop-in firewall for LLM traffic. Three integration modes:

      * **Scan API** — explicit `/scan/input` and `/scan/output` calls.
      * **Reverse proxy** — wire-compatible with the OpenAI and Anthropic
        SDKs; swap the SDK's `base_url` to enable scanning at the network
        boundary.
      * **Tool-call scan** — sub-millisecond regex check on agent tool
        arguments before execution.

    See `runtime-security-guide.md` for prose docs, SDK examples, and a
    walk-through of verdicts and configuration.
  contact:
    name: Blindsight Support
    url: https://blindsight.example.com/support
  license:
    name: Proprietary
servers:
  - url: https://api.blindsight.example.com
    description: Production
  - url: https://api.staging.blindsight.example.com
    description: Staging
security:
  - ApiKeyAuth: []
  - BlindsightKeyAuth: []
  - SessionCookieAuth: []
tags:
  - name: Scan
    description: Single-call scan endpoints for input, output, batch, and tool calls.
  - name: Proxy
    description: Wire-compatible reverse-proxy endpoints for OpenAI and Anthropic.
  - name: Configuration
    description: Workspace-scoped firewall settings.
  - name: Analytics
    description: Read-only analytics, event log, and drift dashboard endpoints.
  - name: Health
    description: Liveness and ECS service status.
paths:
  /api/runtime-security/proxy/openai/v1/chat/completions:
    post:
      tags:
        - Proxy
      summary: Wire-compatible OpenAI Chat Completions proxy
      description: >
        Body and response match `POST
        https://api.openai.com/v1/chat/completions`

        verbatim. Blindsight scans both directions; the verdict either

        forwards (allow), mutates content in place (redact), or returns

        an OpenAI-shaped error (block).


        **Streaming**: pass `stream=true` to receive Server-Sent Events.

        The firewall scans the assembled response on a 250 ms / 80-char

        cadence and emits `finish_reason: content_filter` mid-stream on

        a block verdict.


        **Headers**: `Authorization` is reserved for OpenAI and forwarded

        upstream untouched. Authenticate to Blindsight via `X-API-Key`.
      operationId: proxyOpenAIChat
      requestBody:
        required: true
        description: >-
          OpenAI Chat Completions request body. See
          https://platform.openai.com/docs/api-reference/chat/create for the
          full schema.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
      responses:
        '200':
          description: |
            On `stream=false`, an OpenAI Chat Completion response. On
            `stream=true`, an SSE stream (`text/event-stream`).
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
            text/event-stream:
              schema:
                type: string
                format: byte
        '400':
          description: Blocked by Blindsight (input scan), or invalid body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
        '502':
          description: Upstream OpenAI error, or upstream blocked by output scan
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
components:
  schemas:
    OpenAIError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
            param:
              type: string
              nullable: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |
        Blindsight workspace API key (`ak_live_…`). Use this header for the
        scan API and the OpenAI proxy routes. The required permission
        scope is `runtime_security.scan` for scan endpoints,
        `runtime_security.view` for read-only analytics, and
        `runtime_security.manage` for configuration changes.
    BlindsightKeyAuth:
      type: apiKey
      in: header
      name: X-Blindsight-Key
      description: |
        Alternative header for Anthropic proxy callers — `x-api-key` is
        reserved for the upstream provider on those routes. Accepts an
        Blindsight API key or `Bearer <jwt>`.
    SessionCookieAuth:
      type: apiKey
      in: cookie
      name: blindsight_session
      description: In-app dashboard session — for browser callers only.

````