API
The API modality is the recommended way to connect your system to Spectral. Spectral sends conversations directly to your endpoint, with no browser or page structure involved.
Your system must expose a publicly accessible POST endpoint at /v1/chat/completions that accepts a conversation history and returns the assistant's next reply, following the OpenAI Chat Completions API format.
Request
POST /v1/chat/completions HTTP/1.1Content-Type: application/json{"messages": [{ "role": "user", "content": "What is the capital of France?" },{ "role": "assistant", "content": "The capital of France is Paris." },{ "role": "user", "content": "And of Germany?" }]}
Spectral reads the assistant reply from choices[0].message.content.
warning
Model parameter not supported:
Many /v1/chat/completions implementations require a model field in the request body. Spectral does not include this parameter. Contact us if this is a hard requirement for your setup.