# Создание ответа модели

**API:** Model API

**Endpoint:** `POST /api/v1/responses`

Эндпоинт, совместимый с OpenAI Responses API. Успешный непотоковый ответ имеет форму объекта Responses; при stream=true эндпоинт возвращает SSE-события Responses. Объект Responses с ошибкой может использовать status=failed и error={code,message}, даже если сам HTTP-запрос завершился успешно.

## Base URL

- `https://openapi.felo.ai` — Боевая среда

## Authentication

- `FeloBearerAuth` (http bearer) — API-ключ Felo, передаваемый как `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — API-ключ Felo, передаваемый как `X-API-Key: <key>`.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | Упорядоченные публичные коды каналов через запятую. Опустите этот заголовок, чтобы использовать значение по умолчанию; default должен использоваться только сам по себе. В режиме wallet значение по умолчанию просматривает эффективный публичный порядок каналов модели в обратном направлении, пропускает неопубликованные и недоступные каналы и выбирает провайдера первого доступного канала. Оно включает доступные эндпоинты этого провайдера с тем же upstream ID модели и уровнем обслуживания. Явные каналы проверяются в порядке, указанном клиентом; отправляется только группа провайдера первого канала. Автоматического переключения на других провайдеров нет. Устаревшие заголовки провайдеров не могут переопределить маршрутизацию по каналам. |

## Request body

Required: **yes**

### application/json

Schema: `ResponsesRequest` (`#/components/schemas/ResponsesRequest`)

```json
{
  "type": "object",
  "required": [
    "model",
    "input"
  ],
  "properties": {
    "model": {
      "type": "string"
    },
    "input": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ],
      "description": "Reference a Felo PDF with input_file.file_id or an uploaded image with input_image.file_id in a message content array. The model must be enabled for the attachment type. The combined limit for Felo file references is 50 MB per request. PDF file_url/file_data and image_url (HTTPS or a data URL) use the native format."
    },
    "instructions": {
      "type": "string"
    },
    "stream": {
      "type": "boolean",
      "default": false
    },
    "temperature": {
      "type": "number",
      "minimum": 0
    },
    "top_p": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "max_output_tokens": {
      "type": "integer",
      "minimum": 1
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "tool_choice": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "previous_response_id": {
      "type": "string"
    },
    "store": {
      "type": "boolean"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    },
    "text": {
      "type": "object",
      "additionalProperties": true
    },
    "reasoning": {
      "type": "object",
      "additionalProperties": true
    },
    "include": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "service_tier": {
      "type": [
        "string",
        "null"
      ],
      "default": "default",
      "description": "Сейчас поддерживается только default (стандартный). Если поле опущено, равно null, содержит псевдоним или неподдерживаемую строку, используется значение по умолчанию; другие типы возвращают HTTP 400. Настроенные каналы и цены не меняются. Текстовые API передают стандартное значение провайдера; Decisions и API генерации опускают поле upstream."
    }
  },
  "additionalProperties": true
}
```

Example:

```json
{
  "model": "gpt-5.5",
  "input": "Explain why the sky is blue in one sentence.",
  "stream": false
}
```

## Responses

### 200 — Объект ответа или события потокового ответа

**application/json**

Schema: `ResponsesResponse` (`#/components/schemas/ResponsesResponse`)

**text/event-stream**

Schema: string

```json
{
  "type": "string",
  "description": "SSE-события Responses API."
}
```

### 400 — Некорректный запрос, модель или сопоставление провайдера

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 401 — Недействительный или отсутствующий API-ключ Felo

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 402 — Недостаточно средств на балансе

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 403 — Аккаунт не имеет права использовать модель. Отключённые модели также отклоняются до вызова upstream. Уже принятые запросы и задачи продолжают выполняться.

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 429 — Достигнут лимит расходов или запросов

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 502 — Сбой запроса к upstream-провайдеру

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

### 503 — Провайдер или сервис биллинга недоступен

**application/json**

Schema: `OpenAIErrorResponse` (`#/components/schemas/OpenAIErrorResponse`)

## Schema definitions

### OpenAIErrorResponse

`#/components/schemas/OpenAIErrorResponse`

```json
{
  "type": "object",
  "description": "Конверт ошибок, совместимый с OpenAI. Router может включать code и message без всех необязательных полей upstream.",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "Тип ошибки, совместимый с OpenAI, если он передан."
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "code": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
```

### ResponsesError

`#/components/schemas/ResponsesError`

```json
{
  "type": "object",
  "required": [
    "code",
    "message"
  ],
  "properties": {
    "code": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "additionalProperties": true
}
```

### ResponsesResponse

`#/components/schemas/ResponsesResponse`

```json
{
  "type": "object",
  "required": [
    "id",
    "object",
    "status"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "const": "response"
    },
    "status": {
      "type": "string",
      "enum": [
        "completed",
        "failed",
        "in_progress",
        "cancelled",
        "queued",
        "incomplete"
      ]
    },
    "output": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "output_text": {
      "type": "string"
    },
    "error": {
      "$ref": "#/components/schemas/ResponsesError"
    },
    "usage": {
      "$ref": "#/components/schemas/Usage"
    },
    "model": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
```

### Usage

`#/components/schemas/Usage`

```json
{
  "type": "object",
  "description": "Объект использования провайдера. Поля зависят от эндпоинта и провайдера.",
  "additionalProperties": true
}
```
