POST /v1/chat/completions
Create a chat completion with guardrails applied. This endpoint is compatible with the OpenAI Chat Completions API with additional guardrails-specific extensions.Request
string
required
The LLM model to use for chat completion (e.g., “gpt-4o”, “llama-3.1-8b”).
array
The list of messages in the current conversation.
boolean
default:"false"
If set, partial message deltas will be sent as server-sent events.
integer
The maximum number of tokens to generate.
number
Sampling temperature to use (0.0 to 2.0).
number
Top-p sampling parameter (0.0 to 1.0).
string | array
Stop sequences where the API will stop generating further tokens.
number
Presence penalty parameter (-2.0 to 2.0).
number
Frequency penalty parameter (-2.0 to 2.0).
Guardrails Extensions
object
Guardrails-specific options:
string
The guardrails configuration ID to use.
array
List of configuration IDs to combine. Cannot be used with
config_id.string
The ID of an existing thread to continue (minimum 16 characters).
object
Additional context data for the conversation.
GenerationOptions
Additional generation options:
rails: Which rails to enable ({"input": true, "output": true})log: Logging options ({"activated_rails": true, "llm_calls": true})output_vars: Variables to extract from context
object
State object to continue the interaction. Must contain
events or state key.Response
string
Unique identifier for the chat completion.
string
Always “chat.completion”.
integer
Unix timestamp of when the completion was created.
string
The model used for the completion.
array
object
Response Examples
Error Responses
object