This endpoint sits outside the
/api/v1 namespace because it’s called by external systems that follow the OpenAI URL convention.Endpoint
Path parameters
string
required
Masker agent ID in
agt_* ULID format. Treat this like an API key — keep the proxy URL confidential.Authentication
This endpoint is not authenticated bymasker_session cookie. Voice platforms calling it do not have a session. Authentication relies on two mechanisms:
- The
agent_idin the URL acts as a shared secret. Do not expose the proxy URL publicly. - When configured, HMAC signature verification validates the
X-Vapi-Signatureheader againstMASKER_VAPI_WEBHOOK_SECRET.
Request body
The request body follows the standard OpenAI chat completions schema. Masker accepts every field OpenAI accepts and passes through unrecognized fields.string
required
The model to use. Must be compatible with the agent’s configured
upstream. If the request specifies a model the agent is not allowed to use, Masker returns 422 model_not_allowed.object[]
required
Array of message objects (
role + content). PHI is redacted from all content fields before forwarding.boolean
default:"false"
If
true, the response is streamed as Server-Sent Events (text/event-stream). Streaming is fully supported — response chunks are scanned for tokens and rehydrated inline.number
Sampling temperature, passed through to the upstream LLM unchanged.
number
Maximum tokens in the response, passed through unchanged.
object[]
Tool definitions. Tool descriptions and function names that contain PHI are also redacted.
string | object
Tool selection mode, passed through unchanged.
Processing pipeline
- Receive the request body.
- Detect and redact PHI in
messages[*].content, tool descriptions, and function names. - Forward the sanitized body to the upstream LLM provider.
- Buffer or stream the response from the upstream LLM.
- Scan the response for Masker replacement tokens and rehydrate them to original values.
- Return the rehydrated response to the caller.
Response
The response is identical in shape to an OpenAI chat completions response. PHI tokens in the LLM output are rehydrated before the response reaches the caller. For streaming requests, the response usestext/event-stream with standard OpenAI SSE chunks.
Latency
Masker adds approximately 45–95 ms of end-to-end latency on top of the upstream LLM’s response time.Rate limit
100 requests/second sustained, burst 200. Rate-limited requests receive429 with a Retry-After header.
Configuration in Vapi
Set the proxy URL as your Vapi assistant’s Custom LLM URL:gpt-4o-mini). No other code changes are required.