← 返回
安全合规 Key 中文

Tavily Search

Tavily API integration with managed API key authentication. Perform AI-powered web search, extract content from URLs, crawl websites, map site structure, and...
Tavily API 集成与托管 API 密钥认证。执行 AI 驱动的网络搜索、从 URL 提取内容、抓取网站、映射网站结构,以及...
byungkyu
安全合规 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 1
Stars
📥 717
下载
💾 13
安装
1
版本
#latest

概述

Tavily

Access the Tavily API with managed API key authentication. Perform AI-powered web searches, extract content from URLs, crawl websites, map site structure, and run in-depth research tasks.

Quick Start

# Search the web
python <<'EOF'
import urllib.request, os, json
data = json.dumps({"query": "latest AI news", "max_results": 5}).encode()
req = urllib.request.Request('https://gateway.maton.ai/tavily/search', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

https://gateway.maton.ai/tavily/{endpoint}

Replace {endpoint} with the Tavily API endpoint (search, extract, crawl, map, research). The gateway proxies requests to api.tavily.com and automatically injects your API key.

Authentication

All requests require the Maton API key in the Authorization header:

Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Tavily API key connections at https://ctrl.maton.ai.

List Connections

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=tavily&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'tavily', 'method': 'API_KEY'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Open the returned url in a browser to enter your Tavily API key.

Get Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Delete Connection

python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Tavily connections, specify which one to use with the Maton-Connection header:

python <<'EOF'
import urllib.request, os, json
data = json.dumps({"query": "AI news"}).encode()
req = urllib.request.Request('https://gateway.maton.ai/tavily/search', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
req.add_header('Maton-Connection', '{connection_id}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If omitted, the gateway uses the default (oldest) active connection.

API Reference

Search

Perform AI-powered web search with optional answer generation.

POST /tavily/search
Content-Type: application/json

{
  "query": "What is artificial intelligence?",
  "max_results": 5
}

Request Parameters:

ParameterTypeRequiredDescription
----------------------------------------
querystringYesSearch query string
max_resultsintegerNoNumber of results (0-20, default 5)
search_depthstringNobasic, advanced, fast, ultra-fast (default: basic)
topicstringNogeneral or news (default: general)
include_answerboolean/stringNotrue, false, basic, advanced
include_raw_contentboolean/stringNotrue, false, markdown, text
include_imagesbooleanNoInclude image results
include_domainsarrayNoOnly search these domains (max 300)
exclude_domainsarrayNoExclude these domains (max 150)
time_rangestringNoday, week, month, year
start_datestringNoFilter by date (YYYY-MM-DD)
end_datestringNoFilter by date (YYYY-MM-DD)

Response:

{
  "query": "What is artificial intelligence?",
  "answer": "Artificial intelligence (AI) is...",
  "results": [
    {
      "title": "What is AI?",
      "url": "https://example.com/ai",
      "content": "AI is a branch of computer science...",
      "score": 0.95
    }
  ],
  "response_time": 0.55
}

Extract

Extract content from one or more URLs.

POST /tavily/extract
Content-Type: application/json

{
  "urls": ["https://example.com/article"],
  "format": "markdown"
}

Request Parameters:

ParameterTypeRequiredDescription
----------------------------------------
urlsstring/arrayYesURL or array of URLs to extract
querystringNoUser intent for reranking content
chunks_per_sourceintegerNoMax chunks per source (1-5, default 3)
extract_depthstringNobasic or advanced (default: basic)
formatstringNomarkdown or text (default: markdown)
include_imagesbooleanNoInclude extracted images
timeoutfloatNoMax wait time in seconds (1-60)

Response:

{
  "results": [
    {
      "url": "https://example.com/article",
      "raw_content": "# Article Title\n\nContent in markdown...",
      "images": [],
      "favicon": "https://example.com/favicon.ico"
    }
  ],
  "failed_results": [],
  "response_time": 0.01
}

Map

Discover URLs from a website without extracting content.

POST /tavily/map
Content-Type: application/json

{
  "url": "https://example.com",
  "limit": 20
}

Request Parameters:

ParameterTypeRequiredDescription
----------------------------------------
urlstringYesRoot URL to begin mapping
instructionsstringNoNatural language guidance for crawler
max_depthintegerNoExploration depth (1-5, default 1)
max_breadthintegerNoLinks per page level (1-500, default 20)
limitintegerNoTotal links to process (default 50)
select_pathsarrayNoRegex patterns for URL inclusion
exclude_pathsarrayNoRegex patterns for URL exclusion
allow_externalbooleanNoInclude external links (default true)
timeoutfloatNoMax wait time (10-150 seconds)

Response:

{
  "base_url": "https://example.com",
  "results": [
    "https://example.com/about",
    "https://example.com/products",
    "https://example.com/contact"
  ],
  "response_time": 0.1
}

Crawl

Crawl a website and extract content from discovered pages.

POST /tavily/crawl
Content-Type: application/json

{
  "url": "https://example.com",
  "limit": 10,
  "max_depth": 2
}

Request Parameters:

ParameterTypeRequiredDescription
----------------------------------------
urlstringYesRoot URL to begin crawl
instructionsstringNoNatural language guidance (2x cost)
chunks_per_sourceintegerNoMax snippets per source (1-5, default 3)
max_depthintegerNoExploration depth (1-5, default 1)
max_breadthintegerNoLinks per page level (1-500, default 20)
limitintegerNoTotal links to process (default 50)
select_pathsarrayNoRegex patterns for URL inclusion
exclude_pathsarrayNoRegex patterns for URL exclusion
allow_externalbooleanNoInclude external links (default true)
extract_depthstringNobasic or advanced (default: basic)
formatstringNomarkdown or text (default: markdown)
timeoutfloatNoMax wait time (10-150 seconds)

Response:

{
  "base_url": "https://example.com",
  "results": [
    {
      "url": "https://example.com/about",
      "raw_content": "# About Us\n\nContent...",
      "favicon": "https://example.com/favicon.ico"
    }
  ],
  "response_time": 0.09
}

Research Tasks

Run async research tasks that gather sources and synthesize findings.

Create Research Task

POST /tavily/research
Content-Type: application/json

{
  "input": "What are the latest developments in AI safety?",
  "model": "mini"
}

Request Parameters:

ParameterTypeRequiredDescription
----------------------------------------
inputstringYesResearch task or question
modelstringNomini, pro, or auto (default: auto)
streambooleanNoStream results via SSE (default: false)
output_schemaobjectNoJSON Schema for structured output
citation_formatstringNonumbered, mla, apa, chicago

Response:

{
  "request_id": "582a6eec-9a10-43ba-830f-d9a1aeb19f07",
  "status": "pending",
  "input": "What are the latest developments in AI safety?",
  "model": "mini",
  "created_at": "2026-03-08T11:36:12.674507+00:00",
  "response_time": 0.05
}

Get Research Task

GET /tavily/research/{request_id}

Response (completed):

{
  "request_id": "582a6eec-9a10-43ba-830f-d9a1aeb19f07",
  "status": "completed",
  "content": "## AI Safety Developments\n\nResearch findings...",
  "sources": [
    {
      "title": "Source Title",
      "url": "https://example.com/source",
      "favicon": "https://example.com/favicon.ico"
    }
  ],
  "created_at": "2026-03-08T11:36:12.674507+00:00",
  "response_time": 45
}

Status values: pending, in_progress, completed, failed

Code Examples

JavaScript

// Search with answer
const response = await fetch('https://gateway.maton.ai/tavily/search', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.MATON_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: 'latest AI news',
    max_results: 5,
    include_answer: true
  })
});
const data = await response.json();

Python

import os
import requests

# Search with answer
response = requests.post(
    'https://gateway.maton.ai/tavily/search',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
    json={
        'query': 'latest AI news',
        'max_results': 5,
        'include_answer': True
    }
)
data = response.json()

Notes

  • Search endpoints return AI-generated answers when include_answer is enabled
  • Map returns URLs only; Crawl returns URLs with extracted content
  • Using instructions parameter in crawl/map doubles the credit cost
  • Research tasks are async - poll with GET to check status
  • Research models: mini (fast/efficient), pro (comprehensive)
  • IMPORTANT: When piping curl output to jq or other commands, environment variables like $MATON_API_KEY may not expand correctly in some shell environments

Error Handling

StatusMeaning
-----------------
400Missing Tavily connection or invalid request
401Invalid or missing Maton API key
429Rate limit exceeded
432Plan limit exceeded
433Pay-as-you-go limit exceeded
4xx/5xxPassthrough error from Tavily API

Resources

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 13:36 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

MoltGuard - Security & Antivirus & Guardrails

thomaslwang
MoltGuard — OpenClaw 安全守卫,由 OpenGuardrails 提供。安装 MoltGuard,保护您和您的用户免受提示注入、数据泄露和恶意攻击。
★ 116 📥 30,697
developer-tools

API Gateway

byungkyu
通过 Maton 管理的 API 路由连接外部服务;仅在用户指定目标应用、账户和任务后使用;以读取/列...
★ 392 📥 103,025
content-creation

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 141 📥 41,013