Skills 联网搜索导读
如果你需要最新信息和可引用结果,这页会先说明执行方式、引用格式和费用边界。
web skill 是 TheRouter 托管的内置能力。它会把搜索结果注入模型上下文, 并把引用统一成 message.annotations 里的 URL citation 结构, 这样你的下游解析器不需要为不同 provider 写一堆兼容逻辑。
最小请求
web-search-request.json
{
"model": "openai/gpt-4.1:online",
"messages": [{ "role": "user", "content": "本周欧盟 AI 监管有什么新变化?" }],
"skills": [
{
"id": "web",
"config": {
"engine": "native",
"max_results": 4,
"search_prompt": "Use these sources and cite domain links in markdown."
}
}
]
}怎么解析引用
TypeScript
const data = await client.chat.completions.create(request);
const annotations = data.choices[0]?.message?.annotations ?? [];
const citations = annotations
.filter((item) => item.type === "url_citation")
.map((item) => item.url_citation?.url)
.filter(Boolean);
console.log(citations);联网搜索会增加外部成本
web skill 的费用不只是模型 token。它还会带来外部搜索成本,因此不建议默认长期开启。 只有当提示词真的需要最新信息或来源引用时,再启用它。