---
title: "Redact, call your model, restore — one request"
method: POST
path: "/proxy/chat/completions"
---

# Redact, call your model, restore — one request

`POST /proxy/chat/completions`

## Request

- Base URL: `https://secureai.one/v1`
- URL: `https://secureai.one/v1/proxy/chat/completions`
- Auth: HTTP bearer

Takes an OpenAI-shaped chat request, redacts it, forwards it to your own model vendor using the key in X-Provider-Key, and restores the real values in the reply. Your provider key is forwarded to that one call and never stored. OpenAI-compatible, so an existing client needs only a new base URL.

## Headers

- `X-Provider-Key` string, required
- `X-Provider` 'anthropic' | 'openai' | 'google'

## Request body

- ChatRequest
  - `model` string: Required on the proxy; optional on /chat/completions.
  - `messages` object[], required
    - `role` 'system' | 'developer' | 'user' | 'assistant' | 'tool'
    - `content` string, nullable
    - `tool_calls` object[]: An assistant turn's earlier tool calls, as you received them.
      - `id` string
      - `type` 'function'
      - `function` object
        - `name` string
        - `arguments` string: JSON
    - `tool_call_id` string: On a role "tool" message: the call it answers.
  - `stream` boolean
  - `map` object
  - `allow` string[]
  - `strict` boolean
  - `tools` object[]: /chat/completions only. Functions the model may call; calls come back with real values in their arguments, decided by the account's policy.
    - `type` 'function', required
    - `function` object, required
      - `name` string, required
      - `description` string
      - `parameters` object: JSON Schema for the arguments
  - `tool_choice` union: "auto", "none", "required", or {"type":"function","function":{"name":...}}
    - 'auto' | 'none' | 'required'
    - object

## Response `200`

An OpenAI chat completion, with real values restored

- ChatCompletion
  - `id` string
  - `object` 'chat.completion'
  - `created` integer
  - `model` string
  - `choices` object[]
    - `index` integer
    - `message` object
      - `role` string
      - `content` string
    - `finish_reason` 'stop' | 'length'
  - `usage` object
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer

## Other responses

- `400`: The request was wrong — no model named, no provider key, a body that is not JSON
- `401`: No API key, or one that is not recognised
- `402`: No API access on this account, or out of balance. The code says which.
- `429`: 60 requests a minute per key, or a spending cap reached
- `503`: Redaction could not run, so nothing was sent to any model

---

[API](https://skmtc.dev/secureai/apis/secure-ai.md) · [All operations](https://skmtc.dev/secureai/apis/secure-ai/llms.txt) · [OpenAPI document](https://skmtc.dev/secureai/apis/secure-ai/revisions/6eefd7f53f8b?raw)
