# 基于模型的网络搜索（OpenAI）。

**API:** Data API

**Endpoint:** `POST /v1/beta/openai-websearch/search`

**Tags:** OpenAI Web Search

使用 OpenAI 模型和网络搜索生成带引用的回答。以字符串或消息数组提供 input。模型、工具和搜索次数上限由服务管理。响应是 Responses 对象，其 output 包含 web_search_call 和带 URL 引用的 message 项。usage 报告资源消耗，并非 Felo 扣费。

### 计费参考

- 计量方式：按响应组件计量。
- 参考请求估算：0.3 美元。
- 参考客户倍率：1.0。不得对已结算的客户金额再次应用。

仅供参考的元数据，不是账户报价、保证价格或消费上限。资源额度不同于 Felo 额度。最终扣费以 Felo 计费记录为准。

## Base URL

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

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Request body

Required: **yes**

### application/json

Schema:

```json
{
  "type": "object",
  "required": [
    "input"
  ],
  "properties": {
    "input": {
      "type": "string",
      "description": "你的问题或指令，格式与 OpenAI Responses API 的 `input` 相同。也接受消息数组。",
      "example": "What are the three biggest AI announcements this week? Give one sentence each with sources."
    },
    "max_output_tokens": {
      "type": "integer",
      "description": "可选的答案生成 token 数上限。",
      "example": 1024
    },
    "instructions": {
      "type": "string",
      "description": "可选的高层指令，用于引导答案的语气或格式。"
    }
  }
}
```

Example:

```json
{
  "input": "What are the three biggest AI announcements this week? Give one sentence each with sources.",
  "max_output_tokens": 1024
}
```

## Responses

### 200 — 标准的 OpenAI Responses 对象。`output[]` 交错包含 web_search_call 项和带引用的回答消息；web_search_call 项的数量即为计费的搜索次数。

Headers:
- `X-Request-Id` (string) — 联系 Felo 支持时需提供的请求标识符。

**application/json**

Schema: object

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "example": "response"
    },
    "status": {
      "type": "string",
      "example": "completed"
    },
    "output": {
      "type": "array",
      "description": "有序条目：web_search_call（执行的搜索）和 message（带引用的答案）。",
      "items": {
        "type": "object"
      }
    },
    "usage": {
      "type": "object",
      "properties": {
        "input_tokens": {
          "type": "integer"
        },
        "output_tokens": {
          "type": "integer"
        },
        "input_tokens_details": {
          "type": "object",
          "properties": {
            "cached_tokens": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}
```

### 400 — 无法处理该请求。请检查请求参数。

### 401 — 需要有效的 Felo API 密钥。

### 402 — 由于未满足计费要求，请求无法继续。

### 403 — 该账户无权执行此操作。

### 429 — 已达到请求或支出限额。

### 502 — 服务无法完成该请求。

### 503 — API 或计费服务暂时不可用。

### 504 — 服务在处理请求时超时。

### default — 错误响应；上游透传响应可能采用提供方格式

**application/json**

Schema:

```json
{}
```
