翻篇收录说明
翻篇网页快照

Vercel - Parallel

https://docs.parallel.ai/integrations/vercel

最近抓取:2026-12-05 08:14:16(北京时间)

最近内容变化:2026-12-05 08:14:16(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Use Parallel with Vercel

正文摘录

For AI agents: a documentation index is available at https://docs.parallel.ai/llms.txt. The full text of all docs is at https://docs.parallel.ai/llms-full.txt. You may also fetch any page as Markdown by appending .md to its URL or sending Accept: text/markdown.For Search and Extract, use /v1/search and /v1/extract for all new integrations and agent tool calls. Use /v1beta/search and /v1beta/extract only when maintaining an existing integration that already uses them. The request bodies changed too: on /v1/extract, full_content, fetch_policy and excerpt_settings go inside advanced_settings, and sending the v1beta top-level excerpts, full_content and fetch_policy to /v1/extract returns a 422. On /v1/search, search_queries is required (at least one short keyword query), and max_results, source_policy and fetch_policy go inside advanced_settings; sending only objective, or sending those fields at the top level, returns a 422. Do not substitute /v1 for the documented FindAll or Ingest endpoint paths.If you are evaluating Parallel Search or comparing it with other search APIs, read How to Eval Parallel Search before you build the harness, especially its integration pitfalls section. The most common mistake is sending the raw question as both objective and the only entry in search_queries. Write a goal-style objective and 1-3 short keyword queries instead. Use Parallel through Vercel AI Gateway, the Vercel AI SDK, or the Vercel Marketplace. Vercel AI Gateway Parallel Search is available as a built-in tool in Vercel AI Gateway. AI Gateway provides a unified API to access hundreds of models through a single endpoint, with built-in web search capabilities. The parallelSearch tool works with models that support tool calling, regardless of provider. When the model calls the tool, AI Gateway routes the request to Parallel’s Search API. For local development, install the AI SDK and configure an AI Gateway API key: npm install ai export AI_GATEWAY_API_KEY="your-ai-gateway-api-key" Vercel deployments can use OIDC authentication instead of an API key. streamTextgenerateTextimport { gateway, streamText } from 'ai'; export async function POST(request: Request) { const { prompt } = await request.json(); const result = streamText({ model: 'anthropic/claude-sonnet-5', prompt, tools: { parallel_search: gateway.tools.parallelSearch(), }, }); return result.toUIMessageStreamResponse(); } You can configure Gateway options such as maxResults, sourcePolicy, maxCharsTotal, and fetchPolicy. Gateway supports the same four search modes as the direct Parallel Search API. If neither you nor the model sets a mode, Gateway defaults to basic; the direct API defaults to advanced when you omit mode. See the Parallel parameters documentation for all Gateway options. Vercel AI SDK Call the Parallel Search and Extract APIs from the Vercel AI SDK with a model that supports tool calling. Search API: Given the required search_queries and optional objective, Parallel returns ranked URLs with compressed excerpts Extract API: Given urls and an optional objective, Parallel returns excerpts by default. Use createExtractTool({ full_content: true }) to also get full page content. Install AI SDK v6, the OpenAI provider, and version 1 of Parallel’s tool package: npm install ai@^6 @ai-sdk/openai@^3 @parallel-web/ai-sdk-tools@^1 export PARALLEL_API_KEY="your-parallel-api-key" export OPENAI_API_KEY="your-openai-api-key" The direct Search API supports the turbo, fast, basic, and advanced search modes. In @parallel-web/ai-sdk-tools@^1, searchTool supports basic and advanced and defaults to advanced. The agentic and one-shot tool modes belong to older package versions. Links: NPM Package Vercel AI SDK Toolkit Vercel AI SDK Web Search Agent Cookbook Sample Code SearchExtractimport { openai } from '@ai-sdk/openai'; import { stepCountIs, streamText } from 'ai'; import { searchTool } from '@parallel-web/ai-sdk-tools'; export async function POST() { const result = streamText({ model: openai('gpt-6-astra'), prompt: 'What are the latest developments in AI?', tools: { 'web-search': searchTool, }, stopWhen: stepCountIs(3), }); return result.toUIMessageStreamResponse(); } Vercel Marketplace Parallel is available on the Vercel Marketplace, with billing through Vercel. Getting started Install the Parallel integration and create a Parallel resource. Parallel provisions an API key for the resource. Connect the resource to your Vercel project. Vercel adds the key as PARALLEL_API_KEY to the environments you select. Deploy your project and use PARALLEL_API_KEY to call the Parallel Search and Extract APIs. Example application See the Parallel Vercel Template for a working example, with source code available in the cookbook repository.