For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenAI SDK 集成

将 OpenAI SDK 连接到 ThorData MCP 伺服器,使 GPT-4o 和 o 系列模型能够即时进行网路搜寻、抓取和结构化数据访问。

托管 MCP

1

获取您的 API 令牌

  • 前往 SERP API-API Token 创建API Token

  • 复制您的API Token(格式如下:sk_7qBRe***************************)

2

配置您的MCP服务器

from openai import OpenAI

client = OpenAI()

resp = client.responses.create(
model="gpt-4o",
tools=[
{
"type": "mcp",
"server_label": "ThorData",
"server_url": "https://mcp.thordata.net/API_TOKEN/mcp",
"require_approval": "never",
},
],
input="What is the weather in Paris ?",
)

print(resp.output_text)
3

测试一下是否有效

  • 问你的人工智能:“你能用 Google 搜索‘今天的天气’吗?”

  • AI会请求许可——点击“允许”。

  • 你应该能看到效果!

4

监控使用情况

Last updated

Was this helpful?