Skip to content
Docs

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"}
  }'

Request body

ParameterTypeDescription
modelstring, requiredA model ID, from Models or GET /v1/models.
inputstring or array, requiredText, or the conversation as items: messages with input_text, input_image and input_file (Files), function_call and function_call_output.
instructionsstringThe system prompt.
max_output_tokensintegerCap on output tokens, reasoning included.
streambooleanSend response.* events as the answer is generated.
reasoning.effortstringHow much the model thinks. Levels per model in Reasoning.
tools, tool_choice, parallel_tool_callsfunction tools. See Tool calling.
text.format, text.verbosityobject, stringStructured outputs and how long the answer is.
temperature, top_pnumberSampling.

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.

JSON
{
  "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.