API reference
Chat completions
POST /v1/chat/completions. The OpenAI chat completions format, answered from the record within the caller's clearance.
POST https://YOUR-DOOR-ADDRESS/v1/chat/completionsRequests and responses follow the OpenAI chat completions API. Use the OpenAI SDK with base_url set to your door address plus /v1, and your credential headers as default headers. See Doors and credentials.
Request fields the door reads
Section titled “Request fields the door reads”| Field | Type | Notes |
|---|---|---|
model |
string, required | A model alias configured for your organization. See Models. |
messages |
array, required | Non-empty. Roles system, developer, user, assistant and tool. A developer message is treated as system. |
max_completion_tokens |
integer | Upper bound on generated tokens. max_tokens is accepted as well. |
temperature |
number | As in the standard API. |
tools |
array | Function tools, as in the standard API. |
tool_choice |
string or object | As in the standard API. |
metadata |
object | As in the standard API. |
stream |
boolean | true streams server-sent events in the standard chunk format. |
A request body can’t include organization or principal identity. The door limits the number of messages and tools per request.
Example
Section titled “Example”import osfrom openai import OpenAIfrom syderial_headers import load_headers # helper from the Quickstart
client = OpenAI( base_url=os.environ["SYDERIAL_DOOR_URL"] + "/v1", api_key="unused", default_headers=load_headers(),)
completion = client.chat.completions.create( model=os.environ["SYDERIAL_MODEL"], messages=[ {"role": "system", "content": "Answer from the record. Say when the record is silent."}, {"role": "user", "content": "Which decisions changed the V-204 maintenance plan?"}, ], max_completion_tokens=800,)
print(completion.choices[0].message.content)import OpenAI from "openai";import { loadHeaders } from "./syderial-headers"; // helper from the Quickstart
const client = new OpenAI({ baseURL: `${process.env.SYDERIAL_DOOR_URL}/v1`, apiKey: "unused", defaultHeaders: loadHeaders(),});
const completion = await client.chat.completions.create({ model: process.env.SYDERIAL_MODEL!, messages: [ { role: "system", content: "Answer from the record. Say when the record is silent." }, { role: "user", content: "Which decisions changed the V-204 maintenance plan?" }, ], max_completion_tokens: 800,});
console.log(completion.choices[0].message.content);curl "$SYDERIAL_DOOR_URL/v1/chat/completions" \ -H @syderial-headers.txt \ -H "content-type: application/json" \ -d '{ "model": "'"$SYDERIAL_MODEL"'", "max_completion_tokens": 800, "messages": [ {"role": "system", "content": "Answer from the record. Say when the record is silent."}, {"role": "user", "content": "Which decisions changed the V-204 maintenance plan?"} ] }'Response
Section titled “Response”A standard chat completion object, or a stream of standard chunks when stream is true. Syderial adds the evidence and a receipt reference alongside the standard fields. See What Syderial adds to a response.