API reference
Responses
POST /v1/responses speaks the OpenAI Responses format, on the same models and at the same prices as Chat completions. Use it with client.responses.create in the OpenAI SDKs. Try it in the Playground.
curl https://api.libremodel.ai/v1/responses \
-H "Authorization: Bearer $LIBREMODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash-1017",
"input": "Hello, Libremodel",
"reasoning": {"effort": "high"}
}'# pip install openai
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.libremodel.ai/v1",
api_key=os.environ["LIBREMODEL_API_KEY"],
)
response = client.responses.create(
model="deepseek-v4.1-flash-1017",
input="Hello, Libremodel",
reasoning={"effort": "high"},
)
print(response.output_text)// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.libremodel.ai/v1',
apiKey: process.env.LIBREMODEL_API_KEY,
})
const response = await client.responses.create({
model: 'deepseek-v4.1-flash-1017',
input: 'Hello, Libremodel',
reasoning: { effort: 'high' },
})
console.log(response.output_text)Request body
| Parameter | Type | Description |
|---|---|---|
model | string, required | A model ID, from Models or GET /v1/models. |
input | string or array, required | Text, or the conversation as items: messages with input_text, input_image and input_file (Files), function_call and function_call_output. |
instructions | string | The system prompt. |
max_output_tokens | integer | Cap on output tokens, reasoning included. |
stream | boolean | Send response.* events as the answer is generated. |
reasoning.effort | string | How much the model thinks. Levels per model in Reasoning. |
tools, tool_choice, parallel_tool_calls | function tools. See Tool calling. | |
text.format, text.verbosity | object, string | Structured outputs and how long the answer is. |
temperature, top_p | number | Sampling. |
It stores nothing: send the whole conversation in input every time, with store set to false. store: true and previous_response_id return 400. What each format supports: Anthropic and Responses APIs.
Response
A Responses object with status completed, or incomplete when it reached the output cap. output holds the items of the answer: reasoning, message (with its output_text) and function_call.
{
"id": "resp_01a22df851fa7307be622e39f036499d",
"object": "response",
"status": "completed",
"model": "deepseek-v4.1-flash-1017",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{ "type": "output_text", "text": "Hello! How can I help you today?" }]
}
],
"usage": {
"input_tokens": 9,
"input_tokens_details": { "cached_tokens": 0 },
"output_tokens": 10,
"output_tokens_details": { "reasoning_tokens": 0 },
"total_tokens": 19,
"cost": 0.0000132
}
}usage.cost is what the request cost, in dollars.
Streaming
With stream: true the answer arrives as Server-Sent Events, each with its type and sequence_number: response.created and response.in_progress first, then response.output_item.added, the deltas (response.output_text.delta, response.reasoning_text.delta, response.function_call_arguments.delta) and their .done, and response.completed (or response.incomplete) at the end, with usage. If the request fails once started, the last event is error, with its code and message.
Errors
Errors come in the OpenAI shape, the same as Chat Completions: {"error": {"message", "type", "code", "param"}}. Every code: Limits and errors.