Web Search
Give your AI the power to search the web with the built-in web_search tool. Get real-time information, current events, and up-to-date data without any extra setup.
Usage
Simply include {"type": "web_search"} in the tools array of your Responses API request. The model will automatically decide when to search the web based on the query.
Python
Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
response = client.responses.create(
model="openai/gpt-4.1-mini",
tools=[{"type": "web_search"}],
input="What are today's top news stories?",
)
print(response.output_text)JavaScript
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://mume.ai/api/v1",
});
const response = await client.responses.create({
model: "openai/gpt-4.1-mini",
tools: [{type: "web_search"}],
input: "What are today's top news stories?",
});
console.log(response.output_text);cURL
Bash
curl https://mume.ai/api/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "openai/gpt-4.1-mini",
"tools": [{"type": "web_search"}],
"input": "What are today'''s top news stories?"
}'Combining with Function Calling
You can use web_search alongside your own custom functions in the same request. The model will decide which tools to use based on the query.
Python
response = client.responses.create(
model="openai/gpt-4.1-mini",
tools=[
{"type": "web_search"},
{
"type": "function",
"name": "save_summary",
"description": "Save a news summary to the database",
"parameters": {
"type": "object",
"properties": {
"title": {"type": "string"},
"summary": {"type": "string"},
},
"required": ["title", "summary"],
},
},
],
input="Search for AI news today and save a summary",
)Best Practices
- Use web search when your query requires current information — news, stock prices, weather, live scores, etc.
- The model automatically determines when to trigger a search based on the query content.
- Web search works with the Responses API endpoint.
- Combine with function calling to build powerful agents that can search the web and take action.