主题
ai_optimization/chat_gpt/llm_responses/live
POST /v3/ai_optimization/chat_gpt/llm_responses/live
Live ChatGPT LLM Responses
请求方法: POST
接口路径: https://api.seermartech.cn/v3/ai_optimization/chat_gpt/llm_responses/live
本接口用于向指定的 ChatGPT 大语言模型发送提示词,并实时获取结构化响应结果。请求数据使用 UTF-8 编码的 JSON 格式。
每次请求只能提交一个任务。平台限流以认证说明中的 30/60/120 次/分钟规则为准;每个平台同时执行的 Live 任务数量目前限制为每个账户 30 个。
单个 Live 任务的最长执行时间目前为 120 秒。
任务费用会根据模型、输出 Token 数量及联网搜索动态计算。参考价约 ¥0.21 / 次,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求体
POST 请求体是 JSON 数组,且每次只能一个任务:
json
[
{
"user_prompt": "请分析当前法国游乐园行业的发展",
"model_name": "gpt-4.1-mini",
"max_output_tokens": 200,
"temperature": 0.3,
"web_search": true,
"web_search_country_iso_code": "FR",
"web_search_city": "Paris"
}
]请求参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
user_prompt | string | 是 | 发送给 AI 模型的问题或任务。最多 500 个字符。 |
model_name | string | 是 | AI 模型名称。可以指定完整的模型名称和版本;如果只指定基础模型名称,系统将自动使用该模型的最新版本。例如指定 gpt-4.1 时,系统可能自动设置为 gpt-4.1-2025-04-14。可通过 GET /v3/ai_optimization/chat_gpt/llm_responses/models 获取可用模型列表。 |
max_output_tokens | integer | 否 | AI 响应生成的最大 Token 数。推理模型的最小值为 1024,非推理模型的最小值为 16,最大值为 4096,默认值为 2048。启用 web_search 或使用推理模型时,输出 Token 数可能该限制。 |
temperature | float | 否 | 控制响应随机性。取值范围为 0 至 2,默认值为 0.94。数值越高,越多样;数值越低,越集中。推理模型不支持此参数。 |
top_p | float | 否 | 通过限制 Token 选择范围控制响应多样性。取值范围为 0 至 1,默认值为 0.92。不能与 temperature 同时使用。 |
web_search | boolean | 否 | 是否模型搜索互联网并引用实时信息,默认值为 false。只有支持联网搜索的模型才能使用此能力。 |
force_web_search | boolean | 否 | 是否强制模型使用联网搜索。启用此参数时,同时将 web_search 设置为 true,默认值为 false。即使设置为 true,也不能保证最终响应一定网页引用。推理模型不支持此参数。 |
web_search_country_iso_code | string | 否 | 联网搜索使用的国家或地区 ISO 代码。启用此参数时,同时将 web_search 设置为 true。o3-mini、o1-pro 和 o1 模型不支持此参数。 |
web_search_city | string | 否 | 联网搜索使用的城市名称。o3-mini、o1-pro 和 o1 模型不支持此参数。 |
system_message | string | 否 | 用于设定 AI 的角色、语气和行为方式。最多 500 个字符。 |
message_chain | array | 否 | 对话历史。数组中的每个对象 role 和 message 字段。最多支持 10 个消息对象。 |
message_chain[].role | string | 否 | 消息角色,只能为 user 或 ai。 |
message_chain[].message | string | 否 | 消息,最多 500 个字符。 |
tag | string | 否 | 用户自定义的任务标识,最多 255 个字符。该值会原样返回在响应的 data 对象中,可用于请求和结果。 |
message_chain 示例
json
[
{
"role": "user",
"message": "请介绍法国游乐园行业的主要参与"
},
{
"role": "ai",
"message": "法国游乐园行业大型综合主题园、区域性游乐园及家庭娱乐中心。"
}
]响应字段
接口返回 JSON 数据 tasks 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。成功通常为 20000。 |
status_message | string | 请求级状态说明。 |
time | string | 请求执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。 |
status_code | integer | 任务状态码,通常在 10000 至 60000 范围。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求路径信息。 |
data | object | 本次 POST 请求中提交的任务参数。 |
result | array | AI 响应结果数组。 |
result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
model_name | string | 实使用的 AI 模型名称。 |
input_tokens | integer | 消耗的 Token 总数。 |
output_tokens | integer | AI 响应生成的 Token 总数。 |
reasoning_tokens | integer | 生成推理时消耗的 Token 数量。 |
web_search | boolean | 是否使用了联网搜索。 |
money_spent | float | AI 模型 Token 消耗产生的费用。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。 |
datetime | string | 收到结果的时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。例如 2019-11-15 12:57:46 +00:00。 |
items | array | 结构化 AI 响应数组。 |
fan_out_queries | array | 基于原始问题扩展出的搜索查询。 |
items 字段
items 数组可以推理和消息。
reasoning
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 reasoning。推理模型支持,且不保证每次都返回。 |
sections | array | 推理链分段数组。 |
reasoning.sections 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 推理分段类型,固定为 summary_text。 |
text | string | 对模型推理过程的摘要文本。 |
message
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 message。 |
sections | array | AI 响应分段数组。 |
message.sections 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 类型,通常为 text。 |
text | string | AI 生成的文本。 |
annotations | array/null | 生成响应时使用的网页引用。当请求未启用 web_search 时为 null。即使启用了 web_search,该字段也可能为空,因为模型可能未找到网页。 |
annotations 中的字段:
| 字段 | 类型 | 说明 |
|---|---|---|
title | string | 引用来源的域名或标题。 |
url | string | 引用来源 URL。 |
start_index | integer | 引用在文本中的起始索引。 |
end_index | integer | 引用在文本中的结束索引。 |
text | string | 被标注的引用文本。 |
curl 示例
bash
curl --location --request POST \
"https://api.seermartech.cn/v3/ai_optimization/chat_gpt/llm_responses/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"system_message": "请以商务会议中的专业语气进行沟通",
"message_chain": [
{
"role": "user",
"message": "你好,最近怎么样?"
},
{
"role": "ai",
"message": "我很好,谢谢。今天希望讨论什么主题?"
}
],
"max_output_tokens": 200,
"temperature": 0.3,
"model_name": "gpt-4.1-mini",
"web_search": true,
"web_search_country_iso_code": "FR",
"web_search_city": "Paris",
"user_prompt": "请分析当前法国游乐园行业的发展",
"tag": "france-amusement-park-analysis"
}
]'Python 示例
python
import requests
url = "https://api.seermartech.cn/v3/ai_optimization/chat_gpt/llm_responses/live"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
payload = [
{
"system_message": "请以商务会议中的专业语气进行沟通",
"message_chain": [
{
"role": "user",
"message": "请介绍法国游乐园行业的主要参与",
}
],
"max_output_tokens": 200,
"model_name": "gpt-4.1-mini",
"web_search": True,
"web_search_country_iso_code": "FR",
"web_search_city": "Paris",
"user_prompt": "请分析当前法国游乐园行业的发展",
}
]
response = requests.post(url, headers=headers, json=payload, timeout=120)
result = response.json()
if result.get("status_code") == 20000:
print(result)
else:
print(
f"请求失败,状态码:{result.get('status_code')},"
f"信息:{result.get('status_message')}"
)TypeScript 示例
typescript
import axios from "axios";
const response = await axios.post(
"https://api.seermartech.cn/v3/ai_optimization/chat_gpt/llm_responses/live",
[
{
system_message: "请以商务会议中的专业语气进行沟通",
message_chain: [
{
role: "user",
message: "请介绍法国游乐园行业的主要参与",
},
],
max_output_tokens: 200,
model_name: "gpt-4.1-mini",
web_search: true,
web_search_country_iso_code: "FR",
web_search_city: "Paris",
user_prompt: "请分析当前法国游乐园行业的发展",
},
],
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
timeout: 120000,
}
);
if (response.data.status_code === 20000) {
console.log(response.data);
} else {
console.error(
`请求失败,状态码:${response.data.status_code},信息:${response.data.status_message}`
);
}响应示例
json
{
"version": "0.1.20260717",
"status_code": 20000,
"status_message": "Ok.",
"time": "4.8468 sec.",
"cost": 0.2133,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "9f1c2a7e-6f43-4b4d-9c5e-123456789abc",
"status_code": 20000,
"status_message": "Ok.",
"time": "4.8123 sec.",
"cost": 0.2133,
"result_count": 1,
"path": [
"v3",
"ai_optimization",
"chat_gpt",
"llm_responses",
"live"
],
"data": {
"api": "ai_optimization",
"function": "llm_responses",
"se": "chat_gpt",
"model_name": "gpt-4.1-mini",
"web_search": true,
"web_search_country_iso_code": "FR",
"web_search_city": "Paris",
"user_prompt": "请分析当前法国游乐园行业的发展"
},
"result": [
{
"model_name": "gpt-4.1-mini",
"input_tokens": 86,
"output_tokens": 198,
"reasoning_tokens": 0,
"web_search": true,
"money_spent": 0.1800,
"datetime": "2026-07-17 12:57:46 +00:00",
"items": [
{
"type": "message",
"sections": [
{
"type": "text",
"text": "法国游乐园行业仍较强的市场 relevance,主要受游客需求、区域经济和新项目投资推动。",
"annotations": [
{
"title": "示例来源标题",
"url": "https://example.com/source",
"start_index": 0,
"end_index": 50,
"text": "法国游乐园行业仍较强的市场 relevance"
}
]
}
]
}
],
"fan_out_queries": [
"法国游乐园市场规模",
"法国主题园游客数量",
"法国游乐园行业增长趋势"
]
}
]
}
]
}状态码与异常处理
请根据顶层 status_code 和任务级 status_code 判断请求是否成功,并结合 status_message 进行错误处理。
20000:请求或任务执行成功。- 状态码:表示参数错误、认证失败、任务执行失败或异常。
建议在业务系统中处理以下:
- 检查 HTTP 状态码和 API 返回的
status_code。 - 对时、限流和并发任务达到上限进行重试或排队。
- 校验
model_name是否为可用模型。 - 启用联网搜索时,检查模型是否支持
web_search。 - 对
annotations为空、搜索无结果或模型未返回引用的进行容处理。
实用场景
- 分析不同国家或城市的行业趋势与市场需求,为 SEO规划和市场决策提供依据。
- 生成结合实时网页信息的竞品、品牌或行业摘要,提升研究报告和客户洞察的时效性。
- 扩展用户问题对应的搜索词,构建选题、集群和后续 SERP 研究任务。
- 验证多轮对话中的观点与上下文信息,批量生成统一语气的 SEO 咨询、行业分析或客户服务。
- 追踪AI 响应中的引用来源、Token 消耗和联网搜索状态,评估可信度并控制模型调用成本。