Built-In Web Search and Web Reading in LLM APIs: What It Means for Developers

    Some LLM API platforms now run web search and web page reading on the server, so a single request can return an answer based on current information. This article compares that approach with the traditional client-side function calling flow, walks through a basic integration in Python, and covers the engineering effects on latency, cost, control, and compliance.

    Introduction: The Capability Boundary of LLM APIs Is Expanding

    Until recently, a developer who wanted a model to answer a question like “What’s the weather in Shanghai today?” had to build a tool calling pipeline. The client defined the tools, the model returned a call request, the client ran the search, fed the results back to the model, and the model produced the final answer. This flow involves multiple round trips, state management, and error handling, so it takes real engineering effort.

    Model service platforms have started to build common tool capabilities, such as web search and web page reading, directly into their API services. Developers only declare which tools they want in the request. Searching, fetching, and injecting content all happen on the server, so the client gets the final answer from a single request. This “all-in-one” API style is changing how AI applications are built. This article examines what this shift means technically and what it takes to put it into practice.

    1. From Client-Side Tool Calls to Server-Side Tool Execution

    Pain points of the traditional tool calling flow

    In the classic Function Calling pattern, a question answered with tools usually involves these steps:

    1. The client defines each tool’s JSON Schema in the request.
    2. The model returns tool_calls that specify the function to call and its arguments.
    3. The client parses the call and runs the real operation, such as querying a search service or fetching a web page.
    4. The client sends the result back as a tool role message and requests the model again.
    5. The model combines the tool results into its final reply.

    This flow has clear drawbacks. Multiple round trips add latency. The client must maintain session state. Tool implementation, including search engine integration, main-content extraction, and anti-bot handling, is a significant engineering burden. Token costs from multiple requests also need careful accounting.

    What changes with server-side hosted tools

    Server-side tools move steps 2 through 4 into the server. During inference, the model decides on its own when to search, what to search for, and which link to read. All of this happens within the lifecycle of a single HTTP request. The client only declares the tool type and no longer needs any tool execution logic.

    This change goes hand in hand with the trend toward multi-protocol compatibility. Model service platforms across the industry commonly support three mainstream API formats: Chat Completions, Responses, and Messages. Developers can connect with SDKs they already know, so migration costs stay low.

    2. Integration: Search and Answer in One Request

    A typical integration follows these steps.

    Step 1: Get an access credential. Create an API key in the model service platform, and manage it through an environment variable to avoid hardcoding and accidental exposure.

    Step 2: Install the SDK and initialize the client. A common Python SDK is enough. You only need to specify the credential and the service address:

    1. import os
    2. from openai import OpenAI
    3. client = OpenAI(
    4. api_key=os.environ["MODEL_API_KEY"],
    5. base_url="<model-service-base-url>",
    6. )

    Step 3: Declare tools in the request. The key is the tools parameter, which declares two server-side tools: web search and link reading:

    1. resp = client.chat.completions.create(
    2. model="<model-name>",
    3. messages=[
    4. {"role": "user", "content": "What's the weather in Shanghai today? Is it good for going out? Answer briefly."},
    5. ],
    6. tools=[
    7. {"type": "web_search"}, # Web search
    8. {"type": "read_url"}, # Web page reading
    9. ],
    10. )
    11. msg = resp.choices[0].message
    12. print(msg.content)

    As the code shows, the client has no tool execution logic. When the model decides it needs live weather information, it runs the search and page reading on the server, then writes the answer.

    Step 4: Observe the tool call process. Although execution happens on the server, responses usually include a tool call trace for debugging and auditing:

    1. # Check which search and read actions the server actually ran
    2. for step in msg.model_extra.get("server_tool_calls", []):
    3. for call in step["calls"]:
    4. print("Call type:", call["kind"], call["action"])
    5. # Check tool usage for billing
    6. print("Tool call count:", resp.usage.model_extra.get("server_tool_use"))

    This kind of observability matters. Tool calls are often billed separately per call, so developers should track token usage and tool call counts separately in their monitoring.

    3. What This Means for Developers

    1. Lower barrier to entry

    The most direct benefit is less engineering work. A question-answering bot with web access used to require three modules: search service integration, main-content extraction from web pages, and a multi-turn dialogue state machine. Now it fits into one API request with parameters. For small teams and individual developers, building real-time information AI applications becomes much faster.

    2. Thinner clients, deeper dependency

    The client gets thinner, but the application depends more on the model service platform. The server controls search quality, page fetch success rate, and information freshness, so developers lose fine-grained control over retrieval. When choosing a platform, evaluate the sources and coverage of search results, the fallback behavior when something fails, and whether tool calling can be turned off or restricted.

    3. The cost model changes

    Cost shifts from pure token billing to a combined structure of tokens plus tool call counts. A short question may trigger several searches and several page reads. Engineering suggestions:

    • Set budgets and alerts for tool call counts. You can build these with general logging and monitoring services.
    • Do not declare tools for requests that clearly do not need live information, so the model does not trigger searches by mistake.
    • Under high concurrency, cache results for identical queries to reduce repeated tool calls.

    4. Controllability and compliance need extra design

    Because the model decides on its own what to search and which links to read, developers need to consider several things. They need to check whether the sources cited in generated content are reliable, decide whether to constrain the search scope in the prompt, and record tool call traces to meet audit requirements. Sensitive domains such as finance and healthcare need complete call logs.

    4. Typical Use Cases

    • Real-time news Q&A: Direct answers to time-sensitive questions about weather, news, or market data.
    • Document and research support: With the page reading tool declared, the model can read specified links and produce summaries or comparisons.
    • Customer support knowledge enhancement: Answer dynamic questions beyond the knowledge base by combining retrieval capabilities.
    • Content fact-checking: Have the model search for supporting evidence for a claim and give a judgment.

    In these scenarios, if a front-end application or scheduled task needs elastic capacity, you can combine general cloud capabilities such as container platforms, message queues, and object storage to build a complete pipeline. For example, you can deploy the backend service on Baidu AI Cloud, use the model API as the inference layer, and keep the business side focused on orchestration and presentation.

    5. Practical Recommendations and Considerations

    1. Credential security: Store API keys in environment variables or a secrets manager. Never commit them to a code repository.
    2. Turn off unnecessary reasoning overhead: For simple questions, disable deep thinking mode through request parameters to reduce latency and cost.
    3. Timeouts and retries: Server-side tool calls lengthen the time a single request takes. Set the HTTP timeout to two or three times that of a normal request, and implement retries with idempotency protection.
    4. Fallback strategy: When a tool call fails or a search returns nothing, fall back to a pure model answer, and show users in the UI that the information may not be current.
    5. Usage monitoring: Report token usage and tool call counts as separate metrics. They are the basis for cost analysis and anomaly detection.

    Conclusion

    By building web search and web reading into the server side, model APIs consolidate AI application infrastructure at a higher level. Developers shift from building toolchains to orchestrating capabilities. This greatly lowers the barrier for real-time information applications, but it also requires new engineering habits for cost control, observability, and compliance auditing. Understanding the limits and trade-offs of this shift is necessary to use these all-in-one model service capabilities well.