Built-in LLM Tool APIs: A Technical Guide to Building an All-in-One Assistant

    This article explains how modern LLM APIs move tools such as web search, URL reading, file parsing, OCR, speech recognition, speech synthesis, and content moderation into the server side, and how developers declare these tools in a request instead of orchestrating them client-side. It covers the capability layers, declarative integration with protocol-compatible code, cost and quota governance, reliability and fallback design, and a transferable four-layer architecture for building a complete assistant application.

    1. From Stitching Together Third-Party Tools to Built-in Tool Orchestration

    Building a chat application with web access used to require developers to implement a long chain themselves: first intent detection to decide whether a question needs the web; then a search service call to get candidate links; then fetching and cleaning the page content one by one; then chunking, deduplication, and reranking to pack the most valuable content into the context; and only then letting the model generate an answer. Voice and file capabilities were the same story—transcription, speech synthesis, document parsing, and layout reconstruction were all separate systems, each with its own authentication, billing, and failure retries.

    The newer generation of LLM APIs takes a different approach: these capabilities are pushed down to the server side and attached declaratively as tools. The client no longer implements tool-calling logic; it only declares which tools it needs in the request, and the server handles retrieval, fetching, and parsing, then assembles the results into the context. The engineering significance is that the caller shifts from being an orchestrator to being a declarator, integration complexity drops sharply, and the iteration cadence changes from tracking third-party API changes to adjusting a single parameter.

    It is worth stressing that these capabilities are not entirely new. Search APIs and web-fetching APIs have existed in the industry for a long time. What changed this round is that web access and multimodal capabilities are embedded into the main chat pipeline, with file input, optical character recognition, speech recognition and synthesis, and content safety review filled in, turning “replicate a complete assistant app” from an engineering assembly job into a configuration task.

    2. Capability Map: What Actually Happens in One Request

    Broken down, the built-in tools fall into four layers.

    The first is the information acquisition layer, covering web search and link reading. The former turns a natural-language question into a retrieval request and returns candidate snippets; the latter fetches the content at a given address and performs readability extraction. Together they cover two high-frequency intents: “I don’t know the answer, help me find it” and “here is a link, help me read it.”

    The second is the multimodal input layer, covering file upload and optical character recognition. User-uploaded documents, spreadsheets, and scans must first be parsed into structured text and layout information before they can enter the model context. In engineering terms, watch the size of the parsing output, or a long document can fill the context window in one shot.

    The third is the voice layer, containing speech recognition and speech synthesis. The former converts audio into text; the latter converts text into playable audio. In practice the hard part is not the API itself but unified audio specifications, segmentation strategy, and an end-to-end latency budget.

    The fourth is the governance layer, namely content safety review. It applies to both user input and model output, and is a prerequisite for compliant launch rather than an after-the-fact patch.

    3. Integration: Declarative Calls and Protocol Compatibility

    The mainstream approach keeps compatibility with the common industry protocol so existing code migrates with almost no changes. In the common Python ecosystem, for example, after installing the dependency you only add a tool declaration field to the request body and specify the model name.

    1. import os
    2. from openai import OpenAI
    3. client = OpenAI(
    4. api_key=os.environ["YOUR_API_KEY"],
    5. base_url="https://your-endpoint/v1",
    6. )
    7. resp = client.chat.completions.create(
    8. model="your-model-name",
    9. messages=[
    10. {"role": "system", "content": "You are a rigorous technical assistant; answers must cite evidence."},
    11. {"role": "user", "content": "Check today's local weather and give brief travel advice."},
    12. ],
    13. tools=[
    14. {"type": "web_search"},
    15. {"type": "read_url"},
    16. ],
    17. )
    18. msg = resp.choices[0].message
    19. print(msg.content)
    20. # Server-side tool call trace, for auditing and debugging
    21. for step in getattr(msg, "model_extra", {}).get("server_tool_calls", []):
    22. print(step)

    Two easily overlooked details matter here. The first is time and timezone context. The model itself has no real-time information, and many answer deviations are not retrieval failures but missing background such as the current date, location, and language. Some implementations allow injecting this kind of reminder through a separate role field, resolving “today” into a concrete date, which significantly reduces answer drift. The second is observability. The server-side tool call trace should be recorded in full, including search terms, matched sources, and failure reasons; this is both the basis for troubleshooting and the data foundation for later effectiveness evaluation.

    4. Cost and Quotas: Put the Bill into the Architecture

    Built-in tools are usually billed per call, on top of per-token model billing. The cost model therefore goes from one-dimensional to two-dimensional: the cost of a session = model input and output token cost + tool call cost + multimodal processing cost (such as transcription billed by audio duration).

    Several general governance strategies follow:

    • Intent pre-check. Use a lightweight classifier or rules to decide whether the web is needed, avoiding retrieval for small talk.
    • Minimal tool set. Declare only the necessary tools to cut needless calls and context bloat.
    • Caching and reuse. Cache results for high-frequency questions and briefly reuse fetch results for the same links.
    • Time-shifting. Move batch, offline parsing and transcription jobs to off-peak hours, which usually yields better pricing.
    • Budget and circuit breaking. Set call quotas per user and per tenant, and degrade to “model-only answers” with a clear notice to the user when exceeded.

    5. Reliability and Experience Design

    The longer the tool chain, the larger the failure surface. Search may time out, fetching may be blocked by anti-scraping, document parsing may hit encrypted or oversized files, and speech recognition may be affected by noise. The robust approach is to design with failure as the norm:

    1. Layered degradation. If retrieval fails, fall back to a pure model answer labeled “no web access”; if fetching fails, answer using only the search snippet.
    2. Separate timeouts from retries. Set an independent timeout for each tool type, retry only idempotent operations, and use exponential backoff.
    3. Traceable citations. Mark sources in the answer to improve credibility and make verification easy for users.
    4. Streaming output. Return the skeleton conclusion first and add details later; combined with speech synthesis this noticeably improves perceived latency.
    5. Input-side validation. Validate file size, audio duration, and link domains up front, blocking errors before the call.

    6. Transferable Architecture Recommendations

    To land similar capabilities in your own product, split the system into four parts: an access layer for protocol adaptation and authentication; an orchestration layer for intent detection, tool declaration, and degradation strategy; a data layer for caching, logging, and call-trace retention; and a governance layer for quotas, review, and auditing. Decoupling the four with clearly defined interfaces is what allows a smooth swap when the model or tool provider changes.

    In related practice at Baidu AI Cloud, this kind of architecture is typically combined with general cloud product categories such as object storage (for audio, video, and documents), message queues (for smoothing peaks and handling offline parsing), container platforms (for hosting parsing and transcription workloads), and logging services with monitoring and alerting (for observing latency and failure rates), forming a closed loop from access to operations.

    7. Conclusion

    Making web access, multimodality, and safety into “declarable tools” essentially converges complex orchestration onto the server side, freeing developers to refocus on business and experience. What truly determines the quality of the finished product is no longer whether you can connect to a given API, but whether intent detection is accurate, whether fallback paths are complete, whether cost is controllable, and whether results are traceable. Master this methodology and, no matter how the underlying model changes, you can reliably build a fully capable intelligent assistant.