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
Fireworks serves open models through an OpenAI-compatible API. This guide shows how to give a Fireworks model a .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. Do not substitute /v1 for the documented FindAll or Ingest endpoint paths.web_search tool backed by Parallel Search, so it can answer questions about current topics and cite its sources.
The example is a small search app in a single file. You ask a question, the model searches the web with Parallel, and you get back an answer with source URLs.
How it works
- You send a question to a Fireworks model through the chat completions API, along with a
web_searchtool definition. - The model decides it needs fresh information and returns a tool call with a search objective and a few keyword queries.
- Your code sends the objective and queries to Parallel Search at
POST https://api.parallel.ai/v1/search. - You return the search results to the model as a tool message.
- The model writes a final answer from the results and lists the URLs it used.
What you’ll need
- A Fireworks API key, exported as
FIREWORKS_API_KEY. - A Parallel API key, exported as
PARALLEL_API_KEY. - Python 3.10 or later. For the TypeScript version, Node.js 22 or later.
Install
Build the search app
Save the Python version assearch_app.py and run it with python search_app.py. Save the TypeScript version as search_app.ts and run it with npx tsx search_app.ts.
accounts/fireworks/models/kimi-k3), which Fireworks lists as a recommended model for agents with tool use. You can switch to any Fireworks model that supports function calling by changing MODEL.
Example output
When the model decides to search, its tool call arguments look like this:url, title, publish_date, and excerpts. The app passes the results array to the model unchanged:
search_id, session_id, warnings, and usage. See the Search API reference for every field.
The final answer is plain text that ends with the sources the model used:
Tips
- Choose a model that supports function calling. Not every Fireworks model supports tools. Look for Function Calling on the model’s page in the Fireworks Model Library, or see Fireworks’ recommended models for agents with tool use. Fireworks also recommends a low temperature, between 0.0 and 0.3, for tool calling.
- Pass the assistant message back as is. Reasoning models on Fireworks can return
reasoning_contentalongside tool calls. Appending the SDK message object keeps that context for the next call. See interleaved thinking in the Fireworks docs. - Pick a Search mode. The example uses
fast, which returns high-quality results in around 700ms and suits most tool-calling loops. Useturbofor the lowest latency and cost. Leave outmodeto use the defaultadvancedmode when quality matters more than speed. See Search modes. - Set the result count.
advanced_settings.max_resultssets the maximum number of results. It defaults to 10 and Search returns at most 20. Fewer results keep the model’s context small. See Advanced settings. - Reuse one session per question. The example creates a
session_idfor each question and sends it with every search for that question. This groups related calls, as described in Search best practices. - Cite sources. Every result includes its
url, and the system prompt asks the model to list the URLs it used. If your app needs a guaranteed source list, also collect the URLs from the search results in your code.
Costs
You pay Fireworks for model tokens and Parallel for each search. See Fireworks serverless pricing and Parallel pricing. Search pricing depends on the mode, and each tool call is one search request.Next steps
- Extract: add a second tool so the model can read full pages or focused excerpts from URLs it finds.
- Search MCP: connect Parallel Search and Extract to an MCP client without writing a tool handler.
- Search best practices: write better objectives and search queries.
- Fireworks docs: tool calling, OpenAI compatibility, and the serverless quickstart.