Skip to main content
Fireworks serves open models such as Kimi, GLM, DeepSeek, and Qwen through an OpenAI-compatible API. Exa gives those models live web search and full page contents. Point the OpenAI SDK at Fireworks, pass it the Exa SDK’s ready-made tools, and any Fireworks model that supports function calling can search the web and read the pages it finds.

Get started

1

Install the SDKs

2

Set up your API keys

Set the EXA_API_KEY and FIREWORKS_API_KEY environment variables. Create a Fireworks key in the Fireworks dashboard and an Exa key in the Exa dashboard.

Get your Exa API key

Create a key in the dashboard. New accounts start with free credits.
3

Run the tool loop

Create an OpenAI client with the Fireworks base URL and pass the Exa tools in tools. handle_tool_calls runs every Exa tool call in the model’s message and returns the role: "tool" messages to append. Repeat until the model answers without tool calls.
web_search finds pages the model has not seen. get_contents reads pages it already has URLs for, from an earlier search or from the user. Register either or both.
Any Fireworks model with function calling works. Swap MODEL for another ID from the Fireworks model library, or for your own fine-tuned model or on-demand deployment.

Configuring the tools

Calling the factories with no arguments gives Exa’s recommended defaults. The search tool runs a type="auto" search with contents={"highlights": True}, which returns query-relevant excerpts from each result. The contents tool returns page text. Keyword arguments you pass to a factory override these defaults, and a custom name lets you run differently configured Exa tools side by side. See OpenAI tool calling for every option, mixing in your own tools, and writing the loop by hand.

Search first, then generate

When your code decides what to search, skip tool calling. Run one Exa search with contents and pass the results to a Fireworks model as numbered sources. This fits pipelines such as research briefs, monitoring digests, and dataset generation.
Python
Use contents={"text": True} instead of highlights when the model needs full page text. See search best practices for choosing a search type and filters.

Pricing

Exa calls bill to your Exa account at standard Exa pricing. Fireworks bills model tokens to your Fireworks account.

Resources

Fireworks tool calling

Tool definitions, supported models, and tool choice options on Fireworks.

Cookbook

Build a research assistant with Exa search and Fireworks models, with a runnable notebook.