LLM API Built-in Tools: A Practical Guide to Implementation

    This guide explains how built-in tools in large model APIs are changing the way developers build AI features. It covers what these tools include, how to enable them through parameters or standalone endpoints, how to estimate billing and capacity, and the compliance requirements for public-facing applications. You will also find practical recommendations for structuring a layered architecture around these capabilities.

    1. The Shift: From In-App Capabilities to In-API Capabilities

    In the past, capabilities such as web search, document parsing, speech synthesis, and speech recognition were typically available only inside a vendor’s own client application. If developers wanted a similar experience in their own products, they had to stitch together search services, parsing services, speech services, and moderation services. The result was a long pipeline, complex state management, and failure points scattered across the stack.

    The recent change is that these capabilities are being abstracted into built-in tools at the API layer. Developers can enable them directly in a chat request with a few parameters, or call OCR, ASR, TTS, and similar capabilities as standalone endpoints. In essence, an end-to-end experience is being pushed down into composable server-side capabilities, letting developers describe their needs in a more declarative way.

    This shift brings three direct benefits:

    • Context assembly and tool-call orchestration are handled server-side, so client code becomes significantly thinner.
    • Multi-protocol compatibility (message-based, response-based, and chat-completion-based) lowers migration costs.
    • Capabilities are pluggable, so the same business logic can power both an enhanced chat experience and a full reproduction of a client application.

    2. What Built-in Tools Actually Include

    Based on public information, these built-in tools generally cover five categories:

    1. Standard web search: retrieves web pages or images outside deep-thinking mode and includes citation sources in the answer.
    2. Deep-thinking search: autonomously initiates retrieval and opens web pages during multi-step reasoning, forming a think-and-search loop.
    3. File input: parses PDFs, office documents, images, and similar files into the conversation context.
    4. Link reading: automatically detects links in user messages and fetches the page content.
    5. Safety checks: reviews both input and output, returning a refusal marker when a risk is detected.

    The key engineering point is that these tools are not magic switches. They are deterministic actions that the server inserts into the inference loop. Enabling search means a request may trigger external retrieval, result truncation, and citation backfilling. Enabling file parsing means uploaded objects must first land in object storage before a parsing service converts them into structured text. Enabling safety checks adds a decision step before and after generation, which may change the final shape of the response.

    3. How to Integrate: Parameterized Enablement and Standalone Calls

    There are two typical patterns. The first is enabling built-in tools through parameters in a chat request, for example declaring that web search or link reading is needed via a tool toggle field:

    1. {
    2. "model": "your-model-name",
    3. "messages": [{"role": "user", "content": "Summarize the key conclusion of this link: https://example.com/a"}],
    4. "tools": ["web_search", "read_url"],
    5. "safety_check": true
    6. }

    The second is treating a capability as a standalone endpoint: parse a document to get text first and then start a conversation; or run speech recognition to get a transcript and then pass it to the model; or synthesize speech from the generated result afterward. A representative flow looks like this:

    1. Upload file -> Object storage -> Parse/OCR -> Structured text -> Chat inference -> Safety check -> TTS output

    Practical recommendations:

    • Validate the pipeline with minimal parameters first (search only, or link reading only), then layer on more capabilities.
    • When tool calls and context assembly are delegated to the server, the client must handle latency jitter caused by backfilling tool results across multiple turns.
    • For long documents, segment and summarize first to avoid context bloat from loading too much parsed text at once.

    4. Billing, Rate Limits, and Capacity Planning

    Built-in tools are usually billed separately on top of base token costs. Common billing dimensions include number of searches, number of fetches, pages parsed, characters synthesized, and audio duration recognized. To estimate costs, build a per-request cost table: multiply each tool’s usage frequency by its unit price, then add token costs to get a comparable range.

    Also note that limited-time discounts are a temporary strategy, so capacity planning should use list prices for upper-bound estimates. Usage-based metrics such as parsed pages and audio duration fluctuate widely, so pair them with monitoring alerts and logging services for usage attribution. Use a message queue to smooth peaks when necessary, so a traffic spike does not exhaust your quota.

    5. Compliance and Safety: Hard Requirements for Public Applications

    If your application is public-facing, safety checks must be enabled. Developers are still responsible for content moderation, completing any required model-related filings, and clearly labeling AI-generated content. Operationally, turn these three items into a pre-release checklist: whether the safety toggle is on by default, whether moderation covers both input and output, and whether generated content carries a label and traceable logs.

    6. Implementation Recommendations

    Design in capability layers: use general-purpose capabilities such as object storage, parsing, and speech at the bottom; wrap toggles and fallbacks in a unified tool gateway in the middle; and let the top layer choose between enhanced chat and a full client experience per business need. If you use relevant general capabilities from Baidu AI Cloud, you can host the gateway on the container platform, use the logging service for auditing, and use monitoring alerts for quota warnings, keeping the architecture neutral and replaceable.