Responses API
The Responses API lets Cadreen handle the hard parts — governance, memory, tool execution — so you don't have to. It's the recommended endpoint for all new projects.
What is the Responses API?
A single endpoint that does what Chat Completions does — plus governance, memory, tool execution, and conversation state. You send a request, Cadreen decides which model to use, applies your rules, executes any tools, and returns a typed response.
Think of it as the difference between calling a model directly and calling an intelligence layer. The model is one component. Cadreen is the system around it.
Quick start
/api/v1/cadreen/responsesSend a simple request. Cadreen handles the rest.
from openai import OpenAI
client = OpenAI(
base_url="https://api.cadreen.com/api/v1/cadreen",
api_key="sk_cadreen_..."
)
response = client.responses.create(
model="cadreen",
input="What connectors do I have?",
instructions="You are a helpful AI assistant."
)
print(response.output_text)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.cadreen.com/api/v1/cadreen",
apiKey: "sk_cadreen_...",
});
const response = await client.responses.create({
model: "cadreen",
input: "What connectors do I have?",
instructions: "You are a helpful AI assistant.",
});
console.log(response.output_text);curl -X POST https://api.cadreen.com/api/v1/cadreen/responses \
-H "Authorization: Bearer sk_cadreen_..." \
-H "Content-Type: application/json" \
-d '{
"model": "cadreen",
"input": "What connectors do I have?",
"instructions": "You are a helpful AI assistant."
}'cadreen to let Cadreen pick. A name from GET /models is answered by that model once your workspace has turned on named models, and the rules still check every tool call it proposes. Any other name is answered by Cadreen. Whenever Cadreen answers, the response's model says cadreen.How it compares to Chat Completions
Both endpoints generate text. The difference is what happens around it.
| Question | Chat Completions | Responses |
|---|---|---|
| How do you send a prompt? | Build a messages[] array with role objects | Send a string or list. System guidance goes in instructions. |
| How do you read the answer? | choices[0].message.content — one string | output_text — or iterate output[] for structured items |
| How do you have a conversation? | You store and resend the full message history every time | Pass the previous response's ID. Cadreen loads the context. |
| What about tools? | Tool calls come back inside the message | Tool calls come back as typed items. Multiple tools in one request. |
| What about reasoning? | Basic | Rich reasoning. Can be kept private with encrypted items. |
When to use which
What you send
| Field | Type | Required | What it does |
|---|---|---|---|
| model | string | Yes | cadreen lets Cadreen pick; a name from GET /models answers once your workspace turns on named models; any other name is answered by Cadreen |
| input | string | array | Yes | The user's message — a string or list of messages and tool results |
| instructions | string | No | System-level guidance. Becomes the system message. |
| tools | array | No | Tool definitions. Cadreen checks your rules before calling any of them. |
| tool_choice | string | object | No | Control which tool is called: auto, none, required, or a specific tool |
| previous_response_id | string | No | Continue a conversation — pass the previous response's ID |
| store | bool | No | Save the response. Defaults to true. |
| stream | bool | No | Get text as it's generated, not all at once |
| max_output_tokens | int | No | Max tokens in the response. Defaults to 4096. |
| text | object | No | Structured output config. Forces JSON matching a schema. |
What you get back
Every response has a unique ID, an output array with structured items, and a ready-to-use text helper.
{
"id": "resp_68af4030592c81938ec0a5fbab4a3e9f",
"object": "response",
"output": [
{
"id": "msg_68af40337e58819392e935fb",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "You have 3 active connectors: GitHub, Slack, and Linear."
}
],
"role": "assistant"
}
],
"output_text": "You have 3 active connectors: GitHub, Slack, and Linear.",
"usage": {
"input_tokens": 42,
"output_tokens": 18,
"total_tokens": 60
},
"store": true
}| Field | What it tells you |
|---|---|
| id | Unique ID for this response (resp_...) |
| output | Structured items — messages, tool calls, reasoning |
| output_text | The full text answer, ready to use |
| usage | How many tokens you used |
| store | Whether Cadreen saved this response |
Get text as it arrives
Set stream: true to receive text as it is written. Useful for chat UIs and long responses where you don't want the user staring at a blank screen.
stream = client.responses.create(
model="cadreen",
input="Tell me about my workspace",
stream=True
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)Let it use your tools
Define tools just like Chat Completions. Cadreen checks your rules before calling any of them.
response = client.responses.create(
model="cadreen",
input="Read main.py and summarize it",
tools=[{
"type": "function",
"name": "read",
"description": "Read a file",
"parameters": {
"type": "object",
"properties": {
"path": {"type": "string", "description": "File path"}
},
"required": ["path"]
}
}]
)When a tool fails, the model gets a code and one fixed sentence, never the error's own text. There is one exception. If a service you connected (an MCP server or a ready-made service) answers that its tool failed, the result has the code "tool_reported_failure" and what the service said, with secrets and email addresses removed and cut at 500 bytes. You connected that service and you run the model loop, so those words are yours to read. If the tool isn't declared read-only, they are followed by "Check before doing it again", because the service didn't say what the tool did before it failed.
Remember conversations
Chat Completions requires you to store and resend the full message history. Responses gives you three options:
# Turn 1
res1 = client.responses.create(
model="cadreen",
input="What is the capital of France?",
instructions="You are a geography expert.",
store=True
)
print(res1.output_text) # "The capital of France is Paris."
# Turn 2 — Cadreen remembers the context
res2 = client.responses.create(
model="cadreen",
input="And its population?",
instructions="You are a geography expert.",
previous_response_id=res1.id,
store=True
)
print(res2.output_text) # "Paris has approximately 2.1 million people..."