# ایجاد یک پاسخ مدل

**API:** Model API

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

نقطه پایانی سازگار با OpenAI Responses API. یک پاسخ موفق غیرجریان‌سازی از شکل شیء Responses استفاده می‌کند؛ وقتی stream=true باشد، نقطه پایانی رویدادهای SSE Responses را برمی‌گرداند. یک شیء Responses ناموفق می‌تواند حتی وقتی خود درخواست HTTP کامل شده است، از status=failed با error={code,message} استفاده کند.

## 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 این هدر را حذف کنید؛ default باید به‌تنهایی استفاده شود. در حالت کیف پول، default ترتیب مؤثر کانال‌های عمومی مدل را به‌صورت معکوس بررسی می‌کند، کانال‌های منتشرنشده یا در دسترس نبودن را رد می‌کند و ارائه‌دهنده اولین کانال در دسترس را انتخاب می‌کند. نقاط پایانی در دسترس آن ارائه‌دهنده با همان شناسه مدل بالادست و سطح سرویس را شامل می‌شود. کانال‌های صریح به ترتیب مشخص‌شده توسط کلاینت اعتبارسنجی می‌شوند؛ فقط گروه ارائه‌دهنده اولین کانال ارسال می‌شود. هیچ بازگشت خودکار به ارائه‌دهندگان دیگر وجود ندارد. هدرهای ارائه‌دهنده قدیمی نمی‌توانند مسیریابی کانال را بازنویسی کنند. |

## 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، نام‌های مستعار و رشته‌های پشتیبانی‌نشده به default بازمی‌گردند؛ انواع دیگر HTTP 400 برمی‌گردانند. کانال‌ها و قیمت‌های پیکربندی‌شده بدون تغییر می‌مانند. APIهای متنی مقدار استاندارد ارائه‌دهنده را ارسال می‌کنند؛ APIهای Decisions و تولید فیلد بالادست را حذف می‌کنند."
    }
  },
  "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 — حساب مجاز به استفاده از این مدل نیست. مدل‌های غیرفعال نیز پیش از فراخوانی‌های بالادست رد می‌شوند. درخواست‌ها و وظایف پذیرفته‌شده موجود ادامه می‌یابند.

**application/json**

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

### 429 — سقف هزینه یا درخواست به پایان رسیده است

**application/json**

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

### 502 — درخواست ارائه‌دهنده بالادست ناموفق بود

**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 را بدون همه فیلدهای اختیاری بالادست شامل شود.",
  "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
}
```
