Felo API PlatformFelo API Platform
全部 DataForSEO 端点
v0.2.0-beta
OpenAPI 3.1.0

实时 Claude LLM 响应

服务器:https://openapi.felo.ai
客户端库

DataForSEO

​

SEO, search-engine results, keyword research, backlinks and AI visibility data.

实时 Claude LLM 响应

​

向 Claude 模型发送 user_prompt 并同步返回其回复。model_name 必须来自 get_dataforseo_ai_claude_llm_responses_models——名称形如 claude-sonnet-5,看似合理的猜测会被拒绝。返回 model_name、input_tokens、output_tokens、reasoning_tokens、web_search、money_spent、datetime、items 和 fan_out_queries。读取响应中的 money_spent 即可知道一次提示词的实际成本。采用 DataForSEO 的信封结构:数据位于 tasks[0].result,结果状态位于 tasks[0].status_code——被拒绝的请求仍会返回 HTTP 200。

计费参考

  • 计量方式:按上报的响应成本计量。
  • 参考请求估算:0.0567 美元。
  • 参考客户倍率:1.0。不得对已结算的客户金额再次应用。

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

请求体
application/json
  • 类型: array (object | null)[]
    • force_web_search
      类型: boolean | null

      强制 AI 智能体使用网络搜索
      可选字段
      要启用此参数,还必须启用 web_search;
      启用后,AI 模型会被强制访问并引用当前网络信息;
      默认值:false;
      注意:即使参数设为 true,也不能保证响应中会引用网络来源

    • max_output_tokens
      类型: integer | null

      AI 响应中的最大 token 数
      可选字段
      最小值:1;
      最大值:4096;
      默认值:2048;
      注意:如果 web_search 设为 true,或请求中指定的是推理模型,输出 token 数可能超过指定的 max_output_tokens 上限
      注意 2:如果 use_reasoning 设为 true,max_output_tokens 的最小值为 1025

    • message_chain
      类型: array (object | null)[] | null

      对话历史 可选字段 表示此前对话轮次的消息对象数组; 每个对象必须包含: role 字符串,值为 user 或 ai 角色; message 字符串,包含消息内容(最多 500 个字符); 数组中最多可指定 10 个消息对象; 注意:对于 Perplexity 模型,消息必须严格在 user 与 AI 角色之间交替(user → ai); 示例: "message_chain": [{"role":"user","message":"Hello, what’s up?"},{"role":"ai","message":"Hello! I’m doing well, thank you. How can I assist you today?"}]

      • message
        类型: string | null

        消息文本

      • role
        类型: string | null

        消息来源用户的角色

    • model_name
      类型: string

      AI 模型名称
      必填字段
      model_name 由实际模型名称和版本名称组成;
      如果只指定基础模型名称,将默认设置其最新版本;
      例如,指定 claude-opus-4-0 时,会自动将 claude-opus-4-20250514 设为 model_name;
      可单独向 https://api.dataforseo.com/v3/ai_optimization/claude/llm_responses/models 发起请求,获取可用 LLM 模型列表

    • system_message
      类型: string | null

      AI 行为指令
      可选字段
      定义 AI 的角色、语气或特定行为;
      在 system_message 字段中最多可指定 500 个字符

    • tag
      类型: string | null

      用户自定义任务标识符
      可选字段
      字符数上限为 255
      可使用此参数标识任务,并将其与结果对应
      可在响应的 data 对象中找到指定的 tag 值

    • temperature
      类型: number | null

      AI 响应的随机性
      可选字段
      值越高,输出越多样;
      值越低,输出越集中;
      最小值:0
      最大值:1
      默认值:0.7

      注意:同一请求中 temperature 不能与 top_p 同时使用

    • top_p
      类型: number | null

      AI 响应的多样性
      可选字段
      通过限制 token 选择来控制响应的多样性;
      最小值:0
      最大值:1
      默认值:null

      注意:同一请求中 top_p 不能与 temperature 同时使用

    • use_reasoning
      类型: boolean | null

      为 AI 模型启用推理
      可选字段
      启用后,模型会在生成响应前进行推理
      支持 reasoning 的模型列表请参阅 Models 端点
      默认值:false
      注意:如果设为 true,max_output_tokens 的最小值为 1025
      注意 2:如果设为 true,force_web_search 必须设为 false
      注意 3:如果设为 true,则不能使用 temperature 和 top_p

    • user_prompt
      类型: string

      AI 模型的提示词
      必填字段
      要发送给 AI 模型的问题或任务;
      在 user_prompt 字段中最多可指定 500 个字符

    • web_search
      类型: boolean | null

      启用网络搜索以获取当前信息
      可选字段
      启用后,AI 模型可以访问并引用当前网络信息;
      注意:支持 web_search 的模型列表请参阅 Models 端点;
      默认值:false;
      该参数的费用可在 价格页计算

    • web_search_city
      类型: string | null

      用于网络搜索的地点的城市名称
      可选字段

    • web_search_country_iso_code
      类型: string | null

      用于网络搜索的地点的 ISO 国家代码
      可选字段
      可能的值:'AR','AT','AU','BE','BR','CA','CH','CL','CN','DE','DK','ES','FI','FR','GB','HK','ID','IN','IT','JP','KR','MX','MY','NL','NO','NZ','PH','PL','PT','RU','SA','SE','TR','TW','US','ZA'

响应
  • 200
    类型: object | null · Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveResponseInfo
    • cost
      类型: number | null 格式: double

      任务总费用,美元

    • status_code
      类型: integer | null

      通用状态码 完整响应码列表见此处

    • status_message
      类型: string | null

      通用信息性消息 完整的一般信息性消息列表见此处

    • tasks
      类型: array (object | null)[] | null

      任务数组

      • 类型: object | null · Response36Afe1097B20_AiOptimizationClaudeLlmResponsesLiveTaskInfo
        • cost
          类型: number | null 格式: double

          任务总费用,美元

        • data
          类型: object | null

          包含你在 POST 请求中指定的相同参数

          • propertyName
            类型: object | null
        • id
          类型: string | null

          任务标识符 我们系统中 UUID 格式的唯一任务标识符

        • path
          类型: array (string | null)[] | null

          URL 路径

        • result
          类型: array (object | null)[] | null

          结果数组

          • datetime
            类型: string | null

            收到结果的日期和时间
            采用 UTC 格式:“yyyy-mm-dd hh-mm-ss +00:00”
            示例:
            2019-11-15 12:57:46 +00:00

          • fan_out_queries
            类型: array (string | null)[] | null

            扇出查询数组
            包含从主查询派生出的相关搜索查询,以提供更全面的回答

          • input_tokens
            类型: integer | null

            输入中的 token 数
            处理的 token 总数

          • items
            类型: array (object | null)[] | null

            响应条目数组
            包含结构化的 AI 响应数据

            • type
              类型: string | null

              元素类型

          • model_name
            类型: string | null

            所用 AI 模型的名称

          • money_spent
            类型: number | null

            AI token 成本(美元)
            第三方 AI 模型提供商按其定价收取的费用

          • output_tokens
            类型: integer | null

            输出中的 token 数
            AI 响应中生成的 token 总数

          • reasoning_tokens
            类型: integer | null

            推理 token 数
            用于生成推理内容的 token 总数

          • web_search
            类型: boolean | null

            表示是否使用了网络搜索

        • result_count
          类型: integer | null 格式: int64

          result 数组中的元素数

        • status_code
          类型: integer | null

          任务的状态码 由 DataForSEO 生成,范围如下:10000-60000 完整响应码列表见此处

        • status_message
          类型: string | null

          任务的信息性消息 完整的一般信息性消息列表见此处

        • time
          类型: string | null

          执行时间,秒

    • tasks_count
      类型: integer | null 格式: int64

      tasks 数组中的任务数

    • tasks_error
      类型: integer | null 格式: int64

      tasks 数组中返回错误的任务数

    • time
      类型: string | null

      总执行时间,秒

    • version
      类型: string | null

      API 的当前版本

    application/json
  • 400

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

  • 401

    需要有效的 Felo API 密钥。

  • 402

    由于未满足计费要求,请求无法继续。

  • 403

    该账户无权执行此操作。

  • 429

    已达到请求或支出限额。

  • 502

    服务无法完成该请求。

  • 503

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

  • 504

    服务在处理请求时超时。

  • default

    错误响应;上游透传响应可能采用提供方格式

    application/json
Request Example for post/v1/beta/dataforseo/ai_optimization/claude/llm_responses/live
curl https://openapi.felo.ai/v1/beta/dataforseo/ai_optimization/claude/llm_responses/live \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '[
  {
    "system_message": "communicate as if we are in a business meeting",
    "message_chain": [
      {
        "role": "user",
        "message": "Hello, what’s up?"
      },
      {
        "role": "ai",
        "message": "Hello! I’m doing well, thank you. How can I assist you today? Are there any specific topics or projects you’d like to discuss in our meeting?"
      }
    ],
    "max_output_tokens": 200,
    "model_name": "claude-opus-4-0",
    "temperature": 0.3,
    "web_search": true,
    "web_search_country_iso_code": "FR",
    "user_prompt": "provide information on how relevant the amusement park business is in France now"
  }
]'
{
  "version": null,
  "status_code": null,
  "status_message": null,
  "time": null,
  "cost": null,
  "tasks_count": null,
  "tasks_error": null,
  "tasks": [
    {
      "id": null,
      "status_code": null,
      "status_message": null,
      "time": null,
      "cost": null,
      "result_count": null,
      "path": [
        null
      ],
      "data": null,
      "result": [
        {
          "model_name": null,
          "input_tokens": null,
          "output_tokens": null,
          "reasoning_tokens": null,
          "web_search": null,
          "money_spent": null,
          "datetime": null,
          "items": [
            {
              "type": null
            }
          ],
          "fan_out_queries": [
            null
          ]
        }
      ]
    }
  ]
}
Live Claude LLM Responses

需要帮助?