# モデルレスポンスを作成

**API:** Model API

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

OpenAI Responses API 互換のエンドポイントです。非ストリーミングで成功したレスポンスは Responses オブジェクトの形式を使用します。stream=true の場合、エンドポイントは Responses の SSE イベントを返します。失敗した Responses オブジェクトは、HTTP リクエスト自体が完了した場合でも status=failed と error={code,message} を使用できます。

## Base URL

- `https://openapi.felo.ai` — 本番環境

## Authentication

- `FeloBearerAuth` (http bearer) — Felo APIキーを `Authorization: Bearer <key>` として送信します。
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo APIキーを `X-API-Key: <key>` として送信します。

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Felo-Channel` | header | no | string, default: "default" | カンマ区切りの公開チャンネルコード（順序どおり）。このヘッダーを省略すると default が使われ、default は単独でのみ使用できます。ウォレットモードでは、default はモデルの有効な公開チャンネル順を逆から走査し、未公開または利用不可のチャンネルをスキップして、最初に利用可能なチャンネルのプロバイダーを選択します。そのプロバイダーから、同じ上流モデル 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（standard）のみをサポートしています。省略、null、エイリアス、未対応の文字列は default にフォールバックし、それ以外のタイプは HTTP 400 を返します。設定済みのチャンネルと料金は変わりません。テキスト API はプロバイダーの標準値を使用し、Decisions と生成 API は上流のフィールドを省略します。"
    }
  },
  "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": "Responses API の SSE イベント。"
}
```

### 400 — 無効なリクエスト、モデル、またはプロバイダーマッピング

**application/json**

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

### 401 — Felo APIキーが無効または未指定です

**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": "プロバイダーの usage オブジェクト。フィールドはエンドポイントとプロバイダーによって異なります。",
  "additionalProperties": true
}
```
