# Responses

> Create a stateless response, stream typed events, and run client-side functions.

Source: https://i14.ai/docs/api-reference/responses/

`POST https://api.i14.ai/v1/responses`

Send text or a list of input items and receive an array of output items. To use this endpoint, choose a model whose deployment supports Responses. [List models](https://i14.ai/docs/api-reference/models/) to find the IDs your key can use. That list does not establish endpoint or tool support. Some models support only [Chat Completions](https://i14.ai/docs/api-reference/chat-completions/) and [Completions](https://i14.ai/docs/api-reference/completions/). Check which endpoints your model supports before choosing a client.

> **Note**
>
> Responses is stateless. Omit `store` or set it to `false`. Send the conversation history in `input` on each turn. The API rejects non-empty `previous_response_id` or `conversation`, `background: true`, and `store: true`. Response IDs do not retrieve or continue stored responses.

## Request body

Use `Authorization: Bearer YOUR_API_KEY` and `Content-Type: application/json`. See [Authentication](https://i14.ai/docs/authentication/).

| Field                  | Type                                      | What to send                                                                                                                                |
| ---------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`                | string, required                          | A model ID your key can use on this endpoint.                                                                                               |
| `input`                | string or array, required in this example | A prompt, or an ordered array of messages and tool-related items. Resend the relevant prior input and output items on subsequent turns.     |
| `instructions`         | string                                    | Instructions that guide the model for this request.                                                                                         |
| `max_output_tokens`    | integer                                   | Upper bound on generated tokens. Leave room for reasoning if enabled.                                                                       |
| `temperature`, `top_p` | number                                    | Sampling controls. Prefer adjusting one at a time.                                                                                          |
| `stream`               | boolean                                   | Set to `true` for typed server-sent events instead of a single response object.                                                             |
| `store`                | boolean                                   | Omit or pass `false`.                                                                                                                       |
| `tools`                | array                                     | Client-side function definitions. Only `type: "function"` is accepted.                                                                      |
| `tool_choice`          | string or object                          | Choose whether a compatible model may call a function. See [Function calling](https://i14.ai/docs/api-usage/function-calling/).             |
| `reasoning.effort`     | string                                    | On supported models, `none` and `minimal` disable thinking, while `medium` enables it. The control is on/off, not a reasoning-token budget. |

Tool and input capabilities vary by model. The API does not fetch remote media URLs or resolve file IDs. Hosted tools such as web search, file search and remote MCP are not part of this endpoint.

## Create a response

Set `I14_MODEL` to an ID that supports Responses and `I14_API_KEY` to your i14 key.

* cURL

  ```bash
  curl --fail-with-body --silent --show-error https://api.i14.ai/v1/responses \
    -H "Authorization: Bearer $I14_API_KEY" \
    -H "Content-Type: application/json" \
    --data "$(jq -n --arg model "$I14_MODEL" '{model: $model, input: "What is an embedding in one sentence?", max_output_tokens: 256, store: false}')"
  ```

* Python

  ```python
  import os
  from openai import OpenAI

  client = OpenAI(base_url="https://api.i14.ai/v1", api_key=os.environ["I14_API_KEY"])
  response = client.responses.create(
      model=os.environ["I14_MODEL"],
      input="What is an embedding in one sentence?",
      max_output_tokens=256,
      store=False,
  )
  print(response.output_text)
  ```

* Node.js

  ```javascript
  import OpenAI from "openai";

  const client = new OpenAI({ baseURL: "https://api.i14.ai/v1", apiKey: process.env.I14_API_KEY });
  const response = await client.responses.create({
    model: process.env.I14_MODEL,
    input: "What is an embedding in one sentence?",
    max_output_tokens: 256,
    store: false,
  });
  console.log(response.output_text);
  ```

The cURL example uses `jq` to put the model name into the JSON safely.

## Response object

| Field                         | What it means                                                                                                                                                              |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`, `object`, `model`       | The response identifier, object type (`response`) and model identifier.                                                                                                    |
| `status`                      | The outcome. Check this before treating output as final.                                                                                                                   |
| `output`                      | An ordered array of items. A message item may contain `output_text` parts. Tool calls and reasoning can be separate items; do not assume the first item is assistant text. |
| `usage`                       | Token totals such as `input_tokens`, `output_tokens` and `total_tokens`, when reported.                                                                                    |
| `incomplete_details`, `error` | Optional details about an incomplete or failed response.                                                                                                                   |

Example response (selected fields):

```json
{
  "id": "resp_example",
  "object": "response",
  "model": "your-model-id",
  "status": "completed",
  "output": [
    {
      "id": "msg_example",
      "type": "message",
      "role": "assistant",
      "status": "completed",
      "content": [
        {"type": "output_text", "text": "An embedding represents an input as a vector.", "annotations": []}
      ]
    }
  ],
  "usage": {"input_tokens": 15, "output_tokens": 10, "total_tokens": 25}
}
```

`output_text` on the Python and Node.js response objects is an SDK accessor. For raw JSON, read the `output` array instead.

## Stream a response

Set `stream: true` and dispatch events by `type`. For text, append the `delta` from each `response.output_text.delta` event. Read final status and usage from the terminal response when present. Do not parse this stream as Chat Completions chunks or wait for a `[DONE]` sentinel. See the [streaming guide](https://i14.ai/docs/api-usage/streaming/#stream-responses).
