Overview
PipeLLM WebSearch provides real-time web search capability through the Gateway, with per-request billing. Perfect for RAG (Retrieval-Augmented Generation) and building AI agents with web access.
Endpoint
| Method | Endpoint |
|---|
| GET | https://api.pipellm.com/v1/websearch/search |
Authentication
Use your PipeLLM API key in the Authorization header:
Authorization: Bearer YOUR_PIPELLM_API_KEY
Request
| Parameter | Type | Required | Description |
|---|
q | string | Yes | Search query |
Example Request
curl -X GET "https://api.pipellm.com/v1/websearch/search?q=latest+AI+news" \
-H "Authorization: Bearer $PIPELLM_API_KEY"
import requests
import os
response = requests.get(
"https://api.pipellm.com/v1/websearch/search",
params={"q": "latest AI news"},
headers={"Authorization": f"Bearer {os.getenv('PIPELLM_API_KEY')}"}
)
data = response.json()
for result in data.get("data", {}).get("organic", []):
print(f"- {result['title']}: {result['link']}")
const response = await fetch(
"https://api.pipellm.com/v1/websearch/search?q=latest+AI+news",
{
headers: {
Authorization: `Bearer ${process.env.PIPELLM_API_KEY}`,
},
}
);
const data = await response.json();
data.data.organic.forEach((result) => {
console.log(`- ${result.title}: ${result.link}`);
});
{
"code": 200,
"message": "ok",
"took_ms": 6050,
"data": {
"organic": [
{
"title": "AI News | Latest News | Insights Powering AI-Driven Business ...",
"link": "https://www.artificialintelligence-news.com/",
"snippet": "AI News delivers the latest updates in artificial intelligence, machine learning, deep learning, enterprise AI, and emerging tech worldwide."
},
{
"title": "The Latest AI News and AI Breakthroughs that Matter Most",
"link": "https://www.crescendo.ai/news/latest-ai-news-and-updates",
"snippet": "Summary: Xiaomi has announced a next-gen AI voice model optimized for in-car and smart home experiences. The model features faster response times, offline ...",
"contexts": [
{
"idx": 0,
"text": "December 26, 2025\n\n# The Latest AI News and AI Breakthroughs that Matter Most: 2025..."
}
]
}
]
}
}
Response Fields
| Field | Type | Description |
|---|
code | integer | 200 for success |
message | string | Status message |
took_ms | integer | Time taken in milliseconds |
data.organic | array | List of organic search results |
data.organic[].title | string | Page title |
data.organic[].link | string | Page URL |
data.organic[].snippet | string | Page description |
data.organic[].contexts | array | Full content contexts extracted from the page (optional) |
data.organic[].contexts[].idx | integer | Index of the context |
data.organic[].contexts[].text | string | The content text |
Error Response
{
"code": 400,
"message": "Bad Request, missing query parameter"
}
Pricing
| Item | Price |
|---|
| Per Request | $0.05 |
Billing is per successful request. Failed requests are not charged.
Use Cases
RAG Context Enhancement
Use WebSearch to provide real-time context for your LLM:
import requests
import os
from openai import OpenAI
# Step 1: Search the web
search_response = requests.get(
"https://api.pipellm.com/v1/websearch/search",
params={"q": "OpenAI o3 model capabilities"},
headers={"Authorization": f"Bearer {os.getenv('PIPELLM_API_KEY')}"}
)
search_data = search_response.json()
# Step 2: Extract context
context = "\n".join([
f"[{r['title']}]({r['link']}): {r['snippet']}"
for r in search_data.get("data", {}).get("organic", [])[:5]
])
# Step 3: Use with LLM
client = OpenAI(
api_key=os.getenv("PIPELLM_API_KEY"),
base_url="https://api.pipellm.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": f"Use this context:\n{context}"},
{"role": "user", "content": "What are the key features of OpenAI o3?"}
]
)
print(response.choices[0].message.content)
Rate Limits
WebSearch requests share your account’s rate limit. If you receive a 503 Service Unavailable response with Retry-After header, please wait and retry.