百度地图开放平台

所有文档

AI向导

更新时间: 2026/09/10 14:35
流式对话
API服务地址

https://api.map.baidu.com/api_aic/v1/search_stream
Response Content-Type: text/event-stream

基于 HTTP Server-Sent Events(SSE)实现。服务端可主动向客户端推送数据包,适合实时展示思考过程与增量文本。

  • 每个字段(如 data:)以 \n 结尾,整条消息以双换行符 \n\n 结束。

  • 每次发送的消息体均为 JSON 字符串,结构与同步接口返回值保持一致。

  • event 为 data 或 end。end 包在程序报错或请求结束时发出,end 包的 data 为 nil。

  • id 在同一次请求中递增。

  • 若一秒钟没有数据包,会发送一条空白消息用于维持连接。

  • data 包中可能包含思考过程 thought_data,不必定返回。

请求参数与「同步对话」相同。若需文本增量输出,将 text_stream 设为 1。

SSE 数据包示例
event: data
id: 0
data: {"data": {}, "is_end": false, "message": "ok", "status": 0}

思考过程示例:

{
"data": {
"session_id": "557908058564198400",
"query": "骑车去百度科技园",
"dialogue_id": "33113064",
"thought_data": {
"prefix": "正在为你规划从",
"suffix": "的路线",
"keywords": [
"我的位置",
"百度科技园"
]
}
},
"is_end": false,
"message": "ok",
"status": 0
}
参数名称类型含义是否必定返回说明

thought_data

object

思考过程

流式过程中可能返回

thought_data.prefix

string

前缀文案

thought_data.suffix

string

后缀文案

thought_data.keywords

array

关键词数组

对话流 gptmodel_flow
{
"is_end": false,
"log_id": "3534739558",
"message": "ok",
"result": {
"session_id": "804848076497027072",
"query": "介绍一下颐和园",
"answer_type": "gptmodel_flow",
"conversation": [
{
"new_line": false,
"text": "颐和园是北京的著名景点,",
"type": "text",
"target_poi": {
"name": "颐和园",
"std_tag": "旅游景点;其他",
"uid": "2a7a25ecf9cf13636d3e1bad"
}
}
]
},
"status": 0
}
参数名称类型含义是否必定返回说明

conversation

array

对话流片段

conversation[].text

string

文本内容

conversation[].type

string

片段类型

如 text

conversation[].new_line

bool

是否换行

conversation[].target_poi

object

关联 POI

含 name / uid / std_tag

conversation[].note_list

array

相关笔记

含封面、标题、跳转链接

地点推荐 gptmodel_poi
{
"data": {
"session_id": "533247978354245632",
"query": "帮我推荐一下天安门附近的火锅店",
"dialogue_id": "296536",
"answer_type": "gptmodel_poi",
"poi_data": {
"info": {
"tips": "为您找到天安门附近的火锅店",
"tts_tips": "为您找到天安门附近的火锅店"
},
"deeplink_app_url": "",
"deeplink_html_url": "",
"data": [
{
"uid": "c68e523db2bc793c0bf5eb89",
"name": "海底捞(上地华联店)",
"lng": 116.3012,
"lat": 40.0501,
"addr": "北京市海淀区农大南路1号院1号楼上地华联购物中心F4",
"province_name": "北京市",
"city_name": "北京市",
"area_name": "海淀区",
"phone": "(010)62667572",
"business_time": "10:00-07:00",
"tag": "火锅店",
"category": "美食;中餐厅",
"overall_rating": "4.8",
"price": "105.0",
"ai_recommend_reason": "环境宽敞,适合团建。",
"ai_tags": [
"味道很好",
"可停车",
"适合团建"
],
"ai_daka": "52人在这里提到「味道很好」",
"ai_show": "1",
"head_image": "https://poi-pic.cdn.bcebos.com/example.jpg",
"distance": "3.7km",
"distance_local": 370,
"distance_center": 299,
"ranking": "上地最热火锅榜第1名"
}
]
}
},
"message": "ok",
"status": 0
}
参数名称类型含义

poi_data.info.tts_tips

string

播报文案

poi_data.deeplink_app_url

string

跳转端内 POI 列表的 URL,会重新召回,范围约 2000 米

poi_data.deeplink_html_url

string

HTML 跳转链接

poi_data2.data

array

POI 列表

uid

string

POI uid

name

string

名称

lng / lat

float

经纬度

addr

string

地址

province_name / city_name / area_name

string

省市区名称

phone

string

联系电话

business_time

string

营业时间

tag

string

标签

category

string

分类,一级/二级以分号分隔

overall_rating

string

总体评分

price

string

人均价格

ai_recommend_reason

string

AI 推荐理由,接入方可自行截断

ai_tags

array

AI 标签

ai_daka

string

打卡推荐

ai_show

string

为 1 表示推荐理由有意义;为 0 可忽略 ai_recommend_reason

head_image

string

头图

distance

string

距离文案

distance_local

float

距请求坐标的距离,单位:米

distance_center

float

距中心点距离,单位:米;-1 表示无效

ranking

string

榜单信息

deeplink_app_url

string

POI 详情 App 链接

deeplink_html_url

string

POI 详情 HTML 链接

附近没有对应 POI 时,返回空数组,便于区分「出错」与「无结果」:

{
"is_end": false,
"message": "ok",
"result": {
"session_id": "577955271688060928",
"query": "附近500米内的茶颜悦色",
"answer_type": "gptmodel_poi",
"poi_data": {
"info": {
"tts_tips": "抱歉未找到结果,我会好好学习天天向上。"
},
"data": [],
"deeplink_app_url": "",
"deeplink_html_url": ""
}
},
"status": 0
}
路线规划 gptmodel_navigate(驾车)
{
"data": {
"session_id": "533253914162626560",
"query": "帮我规划开车去天安门的路线",
"answer_type": "gptmodel_navigate",
"navigation_data": {
"type": "drive",
"total": 1,
"info": {
"tts_tips": "已为您规划前往天安门的路线。全程23.90公里,大约需要51分钟。"
},
"origin": {
"name": "我的位置",
"lng": 116.339303,
"lat": 40.01116
},
"destination": {
"name": "天安门",
"lng": 116.452562,
"lat": 39.936404
},
"via_points": [
{
"name": "马驹桥服务区",
"lng": "116.568613",
"lat": "39.765945"
}
],
"driving_routes": [
{
"tag": "红绿灯少",
"distance": 2000,
"duration": 1800,
"toll": 0,
"toll_distance": 0,
"restriction_info": {
"status": 0,
"desc": ""
},
"steps": [
{
"leg_index": 0,
"direction": 1,
"distance": 1000,
"duration": 600,
"road_name": "信息路",
"start_location": {
"lng": 116.403874,
"lat": 39.914889
},
"end_location": {
"lng": 116.405288,
"lat": 39.914889
},
"path": "116.403874,39.914889;116.405288,39.914889"
}
]
}
]
}
},
"message": "ok",
"status": 0
}
参数名称类型含义

navigation_data.type

string

drive / bike / walk / public

info.tts_tips

string

播报文案

origin / destination

object

起终点,含 name、lng、lat

via_points

array

途经点

total

int

方案数量

restriction

string

限行提示,无法规避时返回说明

driving_routes

array

驾车方案集

driving_routes[].distance

int

路线全长,单位:米

driving_routes[].duration

int

耗时,单位:秒

driving_routes[].toll

int

预计收费,单位:元

driving_routes[].toll_distance

int

收费里程,单位:米

driving_routes[].tag

string

方案标签

restriction_info.status

int

0 不限行;1 已规避;2 无法规避;3 疫情相关

restriction_info.desc

string

status 为 1 或 2 时的描述,多条以 | 分隔

steps

array

分段信息,含道路名、距离、耗时、起终点、path

routes_params

object

路线 session 与 mrsl,可用于拼接调起链接

路线规划(骑行)
{
"result": {
"query": "帮我规划骑车去天安门的路线",
"answer_type": "gptmodel_navigate",
"navigation_data": {
"type": "bike",
"info": {
"tts_tips": "已为您规划前往天安门的骑行路线。"
},
"origin": {
"name": "我的位置",
"lng": 116.339303,
"lat": 40.01116
},
"destination": {
"name": "天安门",
"lng": 116.452562,
"lat": 39.936404
},
"bike_routes": [
{
"distance": 15000,
"duration": 3600,
"steps": [
{
"direction": 3,
"distance": 500,
"duration": 100,
"instruction": "向东行驶500米",
"path": "116.403874,39.914889;116.408874,39.914889"
}
]
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义

bike_routes[].distance

int

方案距离,单位:米

bike_routes[].duration

int

耗时,单位:秒

steps.instruction

string

路段描述

steps.path

string

分段坐标串

路线规划(步行)
{
"result": {
"query": "帮我规划步行去天安门的路线",
"answer_type": "gptmodel_navigate",
"navigation_data": {
"type": "walk",
"info": {
"tts_tips": "已为您规划前往天安门的步行路线。"
},
"origin": {
"name": "我的位置",
"lng": 116.339303,
"lat": 40.01116
},
"destination": {
"name": "天安门",
"lng": 116.452562,
"lat": 39.936404
},
"walk_routes": [
{
"distance": 1500,
"duration": 300,
"steps": [
{
"direction": 3,
"distance": 500,
"duration": 100,
"instruction": "向东步行500米",
"path": "116.403874,39.914889;116.408874,39.914889"
}
]
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义

walk_routes[].distance

int

方案距离,单位:米

walk_routes[].duration

int

耗时,单位:秒

steps.instruction

string

路段描述

路线规划(公交)
{
"result": {
"query": "帮我规划坐地铁去天安门的路线",
"answer_type": "gptmodel_navigate",
"navigation_data": {
"type": "public",
"info": {
"tts_tips": "已为您规划前往天安门的公共交通方案。"
},
"origin": {
"name": "我的位置",
"lng": 116.339303,
"lat": 40.01116
},
"destination": {
"name": "天安门",
"lng": 116.452562,
"lat": 39.936404
},
"total": 1,
"public_routes": [
{
"distance": 12000,
"duration": 3600,
"price": 5,
"steps": [
[
{
"distance": 1219,
"duration": 1039,
"instructions": "步行1.2公里",
"vehicle_info": {
"type": 5,
"detail": null
}
},
{
"distance": 8000,
"duration": 1500,
"instructions": "乘坐地铁",
"vehicle_info": {
"type": 3,
"detail": {
"name": "地铁4号线",
"type": "1",
"stop_num": 8,
"on_station": "西二旗",
"off_station": "西单"
}
}
}
]
]
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义

public_routes[].distance

int

方案距离,单位:米

public_routes[].duration

int

耗时,单位:秒

public_routes[].price

float

总票价

steps

array

分段,可能为二维数组

vehicle_info.type

int

1 火车;2 飞机;3 公交;4 驾车;5 步行;6 大巴

vehicle_info.detail.name

string

公交线路名称

vehicle_info.detail.type

string

市内公交类型,1 表示地铁/轻轨

vehicle_info.detail.on_station / off_station

string

上下车站

vehicle_info.detail.stop_num

int

途经站点数

火车、飞机、大巴的 vehicle_info.detail 格式预留,当前暂未接入。

多交通路线

请求参数 multi_route=1 时,每种推荐交通方式返回一条路线。

{
"result": {
"session_id": "28541876856948480",
"query": "明天早上8点开车去故宫",
"answer_type": "gptmodel_future_multi_route",
"multi_route_data": {
"drive": {
"mode": "drive",
"rec_travel": true,
"tts_tips": "已为您规划明天8点前往故宫博物院的路线。全程24.37公里,大约需要46分钟。",
"origin": {
"name": "我的位置",
"lng": "116.279881",
"lat": "40.050676"
},
"destination": {
"name": "故宫博物院",
"lng": "116.403326",
"lat": "39.924105"
},
"driving_routes": []
},
"public": {
"mode": "public",
"tts_tips": "已为您找到明天8点出发,前往故宫博物院方案,全程1小时45分钟。",
"origin": {
"name": "我的位置",
"lng": "116.279881",
"lat": "40.050676"
},
"destination": {
"name": "故宫博物院",
"lng": "116.403326",
"lat": "39.924105"
},
"public_routes": []
}
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义是否必定返回说明

multi_route_data

object

多路线数据

key 为 drive / bike / walk / public

[key].mode

string

出行方式

[key].tts_tips

string

播报信息

[key].rec_travel

bool

是否为推荐交通方式

query 指定交通方式时代表用户指定

[key].deeplink_app_url

string

跳转 App 链接

[key].origin / destination

object

起终点

[key].driving_routes 等

object

对应交通方式的路线数据

结构同 gptmodel_navigate

未来出行 gptmodel_future
{
"data": {
"query": "今天晚上9点在五道口购物中心看电影,开车几点出发合适",
"answer_type": "gptmodel_future",
"future_data": {
"arrival_time": 1724468896,
"departure_time": 1724464800,
"origin": {
"name": "我的位置",
"lng": "116.301578",
"lat": "40.050262"
},
"destination": {
"name": "五道口购物中心",
"lng": "116.339196",
"lat": "39.991931"
},
"info": {
"tts_tips": "建议您至少要在21点0分前出发。全程大约需要24分钟。"
},
"driving_routes": [
{
"tag": "红绿灯少",
"distance": 2000,
"duration": 1800,
"toll": 0,
"toll_distance": 0
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义是否必定返回说明

arrival_time

int

到达时间

Unix 时间戳

departure_time

int

出发时间

Unix 时间戳

origin / destination

object

起终点

name、lng、lat

info.tts_tips

string

提示信息

driving_routes

array

驾车路线

字段同导航驾车方案

出游规划 gptmodel_travel

仅在大模型将 query 识别为出游计划时触发,例如「北京3日游攻略」。需开通高级权限。

{
"data": {
"query": "北京3日游攻略",
"answer_type": "gptmodel_travel",
"travel_data": {
"info": {
"tts_tips": "参考众多资料, 已帮你生成专属攻略"
},
"data": {
"multi_agent_card": {
"deeplink_html_url": "https://map.baidu.com/vercel/h5v3/mark-travel?routeID=example",
"recommend_info": {
"scope_info": {
"title": "推荐景点",
"summary": "北京热门景点:天安门、长城、天坛等。",
"poi_list": [
{
"name": "天安门",
"uid": "65e1ee886c885190f60e77ff",
"lng": "12958170.88",
"lat": "4825940.97",
"std_tag": "旅游景点;文物古迹",
"score": "4.7"
}
]
},
"cater_info": {
"title": "推荐美食",
"summary": "北京热门美食打卡地。",
"poi_list": []
},
"hotel_info": {
"title": "推荐酒店",
"summary": "北京多家酒店上榜热门榜单。",
"poi_list": []
}
},
"travel_trip": {
"head_info": {
"title": "推荐行程"
},
"travel_route": [
{
"days": "1天",
"title": "京城历史之旅",
"summary": "故宫探秘,感受京城历史底蕴。",
"route": [
{
"type": "poi",
"ponit": {
"name": "故宫博物院",
"uid": "06d2dffda107b0ef89f15db6"
}
}
]
}
]
}
},
"note_card": {
"title": "相关推荐笔记",
"note_list": [
{
"head_line": "北京三日游,精华全攻略",
"cover_img": ""
}
]
},
"bubble_card": {
"buble_list": [
{
"title": "北京热门景区3日游"
}
]
}
}
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义是否必定返回

travel_data.info.tts_tips

string

语音播报

multi_agent_card.deeplink_html_url

string

攻略页 HTML 链接

recommend_info.scope_info

object

景点推荐

recommend_info.cater_info

object

美食推荐

recommend_info.hotel_info

object

酒店推荐

poi_list[].name / uid / lng / lat

推荐 POI 基础信息

poi_list[].score / std_tag / address

string

评分、标签、地址

travel_trip.travel_route

array

按天拆分的行程

travel_route[].route[].type

string

poi 或 distance

note_card.note_list

array

相关笔记

bubble_card.buble_list

array

推荐追问气泡

deepseek_card.deep_thinking

string

思考过程

deepseek_card.travel_info

string

攻略正文

POI 澄清 gptmodel_poi_clarify

导航意图下,若 POI 或起终点描述模糊,需要接入方根据返回列表选择后重新发起 search / search_stream。一次 query 中多个 POI 不清晰时,可能连续澄清多次。

{
"data": {
"query": "开车去肯德基",
"answer_type": "gptmodel_poi_clarify",
"poi_clarify_data": {
"info": {
"tts_tips": "为您找到10个肯德基 您要去第几个"
},
"data": [
{
"info": {
"name": "肯德基(新浪总部店)",
"uid": "feab3ad206554aba455726dd",
"address": "东北旺路中关村软件园二期"
},
"location": {
"lng": 116.282648,
"lat": 40.047997
},
"route": {
"distance_local": 380
}
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义是否必定返回说明

poi_clarify_data.info.tts_tips

string

提示语

data[].info.name

string

POI 名称

data[].info.uid

string

POI uid

data[].info.address

string

地址

data[].location.lng / lat

float

经纬度

data[].route.distance_local

int

与当前坐标直线距离

单位:米

沿途搜澄清 gptmodel_onway_search_clarify

大模型识别为沿途搜意图时,接入方需选择途经点后重新发起请求。

{
"result": {
"query": "开车去故宫顺路去个公园",
"answer_type": "gptmodel_onway_search_clarify",
"onwaysearch_clarify_data": {
"info": {
"tts_tips": "途经点是第几个"
},
"data": [
{
"info": {
"name": "中国银行城市森林公园",
"uid": "bd559077fd7bc57688fc0693",
"address": "北京市海淀区马连洼西路",
"tags": [
"旅游景点",
"公园"
]
},
"location": {
"lng": 116.273353,
"lat": 40.040737
},
"route": {
"tags": [
"最近"
],
"distance_local": 2614,
"distance_extra": 1154,
"time_extra": 274,
"time_local": 581
}
}
]
}
},
"status": 0,
"message": "ok"
}
参数名称类型含义是否必定返回说明

onwaysearch_clarify_data.info.tts_tips

string

提示语

data[].info.name / uid / address

string

POI 基础信息

data[].info.tags

array

标签

data[].route.tags

array

如「最近」「最顺路」

data[].route.distance_local

int

到途经点直线距离

单位:米

data[].route.distance_extra

int

绕路增加距离

单位:米,可能为负

data[].route.time_extra

int

增加时长

单位:秒,可能为负

data[].route.time_local

int

到途经点所需时长

单位:秒

澄清后再次请求

根据返回列表选择后,将 query 设为语义化选项(如「第一个」「第二个」),再次调用同步或流式接口,通常返回 gptmodel_navigate。

{
"query": "第一个",
"id": "39CC3177EB9691F***AF556B|VYFRRMJLG",
"loc_lng": 116.30157634933593,
"loc_lat": 40.0502618943843,
"coord_type": "bd09ll",
"ret_coord_type": "bd09ll",
"ak": "您的密钥"
}
服务状态码

与「同步对话」一致,详见同步对话页的服务状态码。

上一篇

同步对话

下一篇

OpenAI协议格式
本篇文章对您是否有帮助?