Browse documentation
API reference

Responses API

Use POST /v1/responses with text input, instructions and an explicit output budget.

Send input

cURL
curl "https://kavren.dev/v1/responses" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-v4.1-flash-fast",
  "input": "Reply with the name of one planet.",
  "max_output_tokens": 64
}'

Use instructions for the model’s instructions. input accepts a string or an array of conversation items.

Optional controls

cURL
curl "https://kavren.dev/v1/responses" \
  -H "Authorization: Bearer $KAVREN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "deepseek-v4.1-flash-fast",
  "input": "Reply in JSON with a planet name.",
  "max_tokens": 128,
  "reasoning_effort": "low",
  "text": {
    "format": {
      "type": "json_object"
    }
  }
}'

Choose one output limit from max_output_tokens, max_tokens and max_completion_tokens. Other supported request fields include reasoning.effort, response_format, temperature, top_p, stop, parallel_tool_calls, include and truncation. Model support determines which options take effect.

Read output items

Example response · selected fields
{
  "object": "response",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Mars"
        }
      ]
    }
  ]
}

Iterate over message items in output and join their output_text parts. A response can also contain tool calls.

Continue a conversation

Send conversation history on each turn. Kavren sets store to false and rejects stored conversation references such as previous_response_id. For a stream, use stream: true and read the named response.* events.

Search Kavren