Skip to main content

Responses

POST/v1/responses

The /responses route is a unified and modern interface for handling complex inputs (text, tools) and structured outputs. It provides greater flexibility for advanced use cases, especially agentic AI and tool calling. It is the recommended route for new OpenAI-compatible developments.

Structure

Each request must include a JSON similar to:

Request body
{
"model": "ClovisLLM",
"input": [
{
"role": "system",
"content": [
{ "type": "input_text", "text": "You are a helpful assistant." }
]
},
{
"role": "user",
"content": [
{ "type": "input_text", "text": "Explain what an API is." }
]
}
],
"temperature": 0.7,
"max_output_tokens": 2000
}

Field description

Request body

FieldTypeRequiredDescription
modelstring✔️Name of the model to use.
inputstringarray✔️Model input: raw text or structured history.
temperaturefloatCreativity (0 = deterministic).
max_output_tokensintMaximum number of generated tokens.
top_pfloatNucleus sampling.
streambooleanEnables response streaming.
stopstringarrayStop token(s).
presence_penaltyfloatDiscourages topic repetition.
frequency_penaltyfloatDiscourages word repetition.
userstringUser identifier (tracking / abuse monitoring).
response_formatobject{ "type": "json_object" } to enforce valid JSON output.
toolsarrayTool declaration (function calling).
tool_choicestringobjectTool selection: auto, none, or a specific tool.

API Response

Main response object

FieldTypeDescription
idstringUnique request identifier (debug / logs).
objectstringReturned object type ("response").
createdint (timestamp)UNIX timestamp (in seconds).
modelstringModel actually used.
outputarrayList of generated outputs (messages, tool calls, etc.).
usageobjectToken usage details.

Details of the output field

Each element in output represents an action or message generated by the model.

FieldTypeDescription
typestringOutput type (message, tool_call, …).
rolestringAssociated role (assistant, tool).
contentarrayStructured content (text, JSON, etc.).

Typical message example

{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "An API is..." }
]
}

finish_reason values (conceptual)

In /responses, the finish reason may appear in internal fields depending on the provider.

ValueMeaning
stopResponse completed naturally.
lengthmax_output_tokens limit reached.
content_filterStopped by a safety / moderation filter.
tool_callsTool call triggered.
nullStreaming in progress or internal error.

Details of the usage field

FieldTypeDescription
input_tokensintTokens used for input.
output_tokensintTokens generated in the response.
total_tokensintSum of both.

Details of the message sub-object (in output)

FieldTypeDescription
rolestringsystem, user, assistant, tool.
contentarrayStructured content: input_text, output_text, etc.

What is the role field used for?

ValueWho is speaking?Typical usageExample
systemAssistant frameworkContext, rules, tone"You are a Clovis assistant..."
userEnd userQuestion / instruction"Explain what an API is."
assistantThe modelGenerated response"An API is..."
toolExternal toolTool call result{ "results": [...] }

Quick summary

{
"id": "string",
"object": "response",
"created": 1700000000,
"model": "ClovisLLM",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "…" }
]
}
],
"usage": {
"input_tokens": 123,
"output_tokens": 456,
"total_tokens": 579
}
}

Usage examples

curl https://llm-gateway.clovis-ai.fr/v1/responses   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-xxxxxxxx"   -d '{
"model": "ClovisLLM",
"input": [
{
"role": "system",
"content": [{ "type": "input_text", "text": "You are a helpful assistant." }]
},
{
"role": "user",
"content": [{ "type": "input_text", "text": "Explain what an API is." }]
}
],
"temperature": 0.7
}'