POST /chat/completions
The Chat Completions endpoint powers conversational agents that rely on the OpenAI-compatible chat contract. Werker Health keeps the exact same request and response payloads, making migrations frictionless.
Base URL:
https://api.werker.health/v1
Request Overview
| Field | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Any Werker-enabled chat model (e.g., gpt-4o, gpt-4o-mini, o4-mini). |
messages | array | ✅ | Conversation history. Each item includes role (system, user, assistant, tool) and content. |
temperature, top_p, presence_penalty, frequency_penalty | number | Optional | Sampling controls identical to OpenAI. |
response_format | object | Optional | Return structured JSON ({"type": "json_object"}) without leaving the chat API surface. |
tools, tool_choice | array / object | Optional | Register functions/actions accessible to the model. |
stream | boolean | Optional | Stream tokens as they are generated over SSE. |
All other OpenAI Chat Completions parameters, including logprobs, max_tokens, and stop, are supported unchanged.
Quick Example
python
from openai import OpenAI
client = OpenAI(
base_url="https://api.werker.health/v1",
api_key="WERKER_HEALTH_API_KEY",
)
completion = client.chat.completions.create(
model="gpt-5",
messages=[
{"role": "system", "content": "You are a HIPAA-compliant triage assistant."},
{"role": "user", "content": "My throat is sore and I have a mild fever."},
],
response_format={"type": "json_object"},
)
print(completion.choices[0].message.content)ts
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.werker.health/v1",
apiKey: "WERKER_HEALTH_API_KEY",
});
const completion = await client.chat.completions.create({
model: "gpt-5",
messages: [
{ role: "system", content: "You are a HIPAA-compliant triage assistant." },
{ role: "user", content: "My throat is sore and I have a mild fever." },
],
response_format: { type: "json_object" },
});
console.log(completion.choices[0].message.content);Streaming Chat
Enable stream: true to receive incremental updates. Each streamed delta is protected by Werker’s two-way PHI scrubbing and persisted to immutable logs for auditability.
Tool Calls
json
{
"tools": [
{
"type": "function",
"function": {
"name": "lookup_medication",
"description": "Return dosage guidance for the supplied medication name.",
"parameters": {
"type": "object",
"properties": {
"medication": { "type": "string" }
},
"required": ["medication"]
}
}
}
],
"tool_choice": "auto"
}Function calling semantics and tool execution callbacks follow OpenAI’s implementation. Werker Health records each invocation and redacted payload for audit consistency.
Compliance Benefits
- Role-based access controls: Lock down who can issue chat completions containing PHI.
- Immutable audit history: Every prompt, tool call, and model response is recorded for compliance review.
- Zero retention guarantee: Werker-routed models are configured never to retain your data for training.
When to Use
- Digital triage, member support, and clinician co-pilots with conversational UX.
- Workflows that already rely on
chat.completionsand need a drop-in compliant backend. - Applications where you want deterministic tool invocation without learning the Responses API yet.
For multimodal, tool-heavy workflows with unified output handling, consider the create-model-response endpoint instead.