# Buat respons model

**API:** Model API

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

Endpoint yang kompatibel dengan API OpenAI Responses. Respons non-streaming yang berhasil menggunakan bentuk objek Responses; saat stream=true, endpoint mengembalikan peristiwa SSE Responses. Objek Responses yang gagal dapat menggunakan status=failed dengan error={code,message} bahkan ketika permintaan HTTP itu sendiri selesai.

## Base URL

- `https://openapi.felo.ai` — Produksi

## Authentication

- `FeloBearerAuth` (http bearer) — Kunci API Felo dikirim sebagai `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Kunci API Felo dikirim sebagai `X-API-Key: <key>`.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | Kode kanal publik yang dipisahkan koma dan berurutan. Hilangkan header ini untuk menggunakan default; default harus digunakan sendiri. Dalam mode wallet, default memindai urutan kanal publik efektif model secara terbalik, melewati kanal yang tidak dipublikasikan atau tidak tersedia, dan memilih penyedia kanal pertama yang tersedia. Ini mencakup endpoint yang tersedia dari penyedia tersebut dengan ID model upstream dan tingkat layanan yang sama. Kanal eksplisit divalidasi dalam urutan yang ditentukan klien; hanya grup penyedia kanal pertama yang dikirimkan. Tidak ada fallback otomatis ke penyedia lain. Header penyedia lama tidak dapat menimpa perutean kanal. |

## 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": "Saat ini hanya default (standard) yang didukung. Nilai yang dihilangkan, null, alias, dan string yang tidak didukung akan kembali ke default; tipe lain mengembalikan HTTP 400. Kanal dan harga yang dikonfigurasi tetap tidak berubah. API teks mengirim nilai standar penyedia; API Decisions dan pembuatan menghilangkan field upstream."
    }
  },
  "additionalProperties": true
}
```

Example:

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

## Responses

### 200 — Objek respons atau peristiwa respons streaming

**application/json**

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

**text/event-stream**

Schema: string

```json
{
  "type": "string",
  "description": "Peristiwa SSE API Responses."
}
```

### 400 — Permintaan, model, atau pemetaan penyedia tidak valid

**application/json**

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

### 401 — Kunci API Felo tidak valid atau tidak ada

**application/json**

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

### 402 — Saldo tidak cukup

**application/json**

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

### 403 — Akun tidak diizinkan menggunakan model. Model yang dinonaktifkan juga ditolak sebelum panggilan upstream. Permintaan dan tugas yang sudah diterima tetap berlanjut.

**application/json**

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

### 429 — Batas pengeluaran atau permintaan tercapai

**application/json**

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

### 502 — Permintaan ke penyedia upstream gagal

**application/json**

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

### 503 — Penyedia atau layanan tagihan tidak tersedia

**application/json**

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

## Schema definitions

### OpenAIErrorResponse

`#/components/schemas/OpenAIErrorResponse`

```json
{
  "type": "object",
  "description": "Envelope error yang kompatibel dengan OpenAI. Router dapat menyertakan code dan message tanpa semua field upstream opsional.",
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "description": "Tipe error yang kompatibel dengan OpenAI jika disediakan."
        },
        "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": "Objek penggunaan penyedia. Field-nya bervariasi menurut endpoint dan penyedia.",
  "additionalProperties": true
}
```
