2 Months Free - Annually

Firecrawl + OpenAI

Give OpenAI models live web search and scraping with Firecrawl.
Define Firecrawl as a function calling tool or add it to the OpenAI Agents SDK.

//
Used by over 1.25M developers
//
Trusted by 150,000+
companies
of all sizes
[ 01 / 04 ]
·
Features
GPT Integration
Web-Enhanced Chat
Combine web scraping with OpenAI's powerful chat models. Build chatbots with real-time web knowledge.
// Example code
const result =
await firecrawl.scrape()
Agentic AI
Function Calling
Let OpenAI models search the web or scrape a page on demand. Build research assistants with current sources.
// Example code
const result =
await firecrawl.scrape()
Data Parsing
Structured Extraction
Extract structured data using GPT-4 and web content. Parse complex websites into clean JSON.
// Example code
const result =
await firecrawl.scrape()
Vector Search
Embeddings Pipeline
Build RAG systems with OpenAI embeddings and web data. Create semantic search over scraped content.
// Example code
const result =
await firecrawl.scrape()

Key Features

Works with any OpenAI model that supports tool calling
Support for function calling and tool use
Streaming responses with web context
Built-in token optimization
Works with the Responses API and the OpenAI Agents SDK
Works with Azure OpenAI Service
[ 02 / 04 ]
·
Installation

Which web search API can I use as an OpenAI function calling tool?

Any web search API with an HTTP endpoint can be an OpenAI function calling tool. Firecrawl's search API fits because one call returns titles, URLs and descriptions, and can return full page Markdown too. Define a web_search function, run the Firecrawl search when the model calls it, and send the results back to the model.

1

Install the packages

Install the OpenAI and Firecrawl Python SDKs. Set FIRECRAWL_API_KEY from your Firecrawl dashboard and OPENAI_API_KEY.

Terminal
pip install -U openai firecrawl-py
export FIRECRAWL_API_KEY="fc-YOUR-API-KEY"
export OPENAI_API_KEY="sk-YOUR-API-KEY"
2

Define the web_search function

The model sees the name, description and JSON schema, and returns a function call with a query when it needs the web. Your code runs the call against the Firecrawl search API.

search_tool.py
import json

from firecrawl import Firecrawl
from openai import OpenAI

client = OpenAI()
firecrawl = Firecrawl()

tools = [
    {
        "type": "function",
        "name": "web_search",
        "description": "Search the web with Firecrawl. Returns titles, URLs and descriptions.",
        "parameters": {
            "type": "object",
            "properties": {"query": {"type": "string", "description": "The search query"}},
            "required": ["query"],
            "additionalProperties": False,
        },
        "strict": True,
    }
]

def web_search(query: str) -> str:
    results = firecrawl.search(query, limit=5)
    return json.dumps(
        [{"title": r.title, "url": r.url, "description": r.description} for r in (results.web or [])]
    )
3

Run the function calling loop

Send the question with the tool defined. While the model keeps asking for searches, run web_search for each function call and return the output with the matching call ID. When a response has no function calls, it holds the final answer.

search_tool.py
input_list = [{"role": "user", "content": "What did OpenAI ship this week? Cite sources."}]

while True:
    response = client.responses.create(model="gpt-6-luna", tools=tools, input=input_list)
    calls = [item for item in response.output if item.type == "function_call"]
    if not calls:
        break
    input_list += response.output
    for call in calls:
        query = json.loads(call.arguments)["query"]
        input_list.append(
            {"type": "function_call_output", "call_id": call.call_id, "output": web_search(query)}
        )

print(response.output_text)

How do I add a web search tool to the OpenAI Agents SDK?

To add web search to the OpenAI Agents SDK, decorate a function that calls Firecrawl search with function_tool and add it to the agent's tools. The SDK builds the tool schema from the type hints and docstring, runs the function when the model calls it, and loops until the agent answers.

1

Install the packages

Install the Agents SDK and the Firecrawl Python SDK, then set both API keys.

Terminal
pip install -U openai-agents firecrawl-py
2

Create the tool and the agent

function_tool turns firecrawl_search into a tool with query and limit arguments. Runner.run_sync runs the agent until it returns a final answer.

agent.py
from agents import Agent, Runner, function_tool
from firecrawl import Firecrawl

firecrawl = Firecrawl()

@function_tool
def firecrawl_search(query: str, limit: int = 5) -> str:
    """Search the web with Firecrawl and return titles, URLs and descriptions.

    Args:
        query: The search query.
        limit: Maximum number of results.
    """
    results = firecrawl.search(query, limit=limit)
    return "\n\n".join(f"{r.title}\n{r.url}\n{r.description}" for r in (results.web or []))

agent = Agent(
    name="Research assistant",
    instructions="Use firecrawl_search for anything current and cite the URLs you used.",
    model="gpt-6-luna",
    tools=[firecrawl_search],
)

result = Runner.run_sync(agent, "What changed in the latest OpenAI Agents SDK release?")
print(result.final_output)
[ 03 / 04 ]
·
What Our Customers Say
//
Community
//

People love
building with Firecrawl

Discover why developers choose Firecrawl every day.
//
FAQ
//

Frequently
asked questions

Everything you need to know about this integration.
General
Yes. Turn on scraping in the Firecrawl search call and each result comes back with its page content as Markdown, or add a second function that scrapes the URLs the model picks.
Technical
Yes. The Responses API can connect to the Firecrawl MCP server as a remote MCP tool, which gives the model Firecrawl search and scrape directly. A function tool gives you more control over what the model receives.
A Firecrawl search costs 2 credits per 10 results, rounded up, and each scraped page costs 1 credit more. The Free plan includes 1,000 credits a month with no credit card.
Why Firecrawl?
The world's most comprehensive web data API. Our custom browser stack and semantic index deliver superior data quality across any website, handling more content types and edge cases than any competitor.
JavaScript rendering, dynamic content, and robust request handling built-in.
Process millions of pages with automatic rate limiting, caching, and distributed infrastructure.
Optimized scraping engine with parallel processing and smart caching for instant results.
Comprehensive docs, SDKs for all major languages, and dedicated support to help you succeed.
[ 04 / 04 ]
·
Pricing

Flexible pricing

Start for free, then scale as you grow.Are you an AI agent? See pricing

Free Plan

A lightweight way to get started.
No cost, no card, no hassle.
$0
/month
500 searches or 1,000 pages scraped
2 concurrent requests
Low rate limits

Hobby

Great for side projects and small tools.
Fast, simple, no overkill.
$16
/month
Billed yearly
Save $38
2,500 searches or 5,000 pages scraped
5 concurrent requests
Basic support
$9 per extra 1.5k credits

Standard
Most popular

Perfect for scaling with less effort.
Simple, solid, dependable.
$83
/month
Billed yearly
Save $198
50,000 searches or 100,000 pages scraped
25 concurrent requests
Standard support
$47 per extra 35k credits

Growth

Built for high volume and speed.
Firecrawl at full force.
$333
/month
Billed yearly
Save $798
250,000 searches or 500,000 pages scraped
50 concurrent requests
Priority support
$177 per extra 175k credits

Scale Plans

High-volume plans for teams that need more power and dedicated support. Get access to higher rate limits, more concurrent browsers, and priority support. Scale checks out instantly, no sales call needed.

Need more? Contact us

Also on AWS Marketplace and Google Cloud Marketplace.

Scale

For teams scaling their data pipelines
1,000,000 credits / month
$599/month
Billed yearly
Save $1,798
500,000 searches or 1,000,000 pages scraped
100 concurrent requests
Priority support
$397 per extra 350k credits

Enterprise

Power at your pace with custom solutions
Custom credits
Custom concurrent requests
Dedicated support & SLA
Bulk discounts
Zero-data retention
SSO & advanced security
//
Get started
//
Ready to enhance your AI?
Start integrating Firecrawl with OpenAI today.
Are you an AI agent? See setup options