Built-in Tools in LLM APIs: How Developers Should Evaluate and Adopt Them

    This article explains how built-in tools in large language model APIs, including web search, web page reading, document parsing, OCR, and speech services, change application development. It covers server-side integration trade-offs, interface compatibility, cost modeling with token and tool fees, stress testing, safety and compliance responsibilities, and how to choose between built-in tools and self-built components.

    1. From Assembling Components to Server-Side Integration

    Previously, a chatbot that could answer real-time questions usually required several separate components. A search service retrieved candidate results. A crawler fetched web page content. A cleaning module removed navigation bars and ads. Finally, the cleaned text was inserted into the prompt and passed to the model to generate an answer. Each component required its own selection and maintenance, along with separate handling for timeouts and retries.

    Recently, more model providers have moved these steps to the server side. Developers only need to enable the relevant option in a request. The server then decides whether to search, which pages to read, and how to organize the context, and returns the result. This reduces integration effort, but it also hands part of the process control to the platform. To decide whether this approach suits a given business, teams need to understand the trade-offs it introduces.

    2. Splitting Capabilities: Tools Can Be Called Separately

    Built-in capabilities typically include the following:

    • Web search: Generates search queries from a question and returns candidate results, each with a title, summary, and link.
    • Web page reading: Takes a URL and returns the main body text with noise removed.
    • Document parsing: Processes formats such as PDF and Office files, extracting text, tables, and layout structure.
    • Optical character recognition (OCR): Recognizes text in scanned documents and images.
    • Automatic speech recognition (ASR) and text-to-speech (TTS): Convert speech to text and text to speech, respectively.

    These capabilities can be triggered automatically within a conversation or called directly as standalone interfaces. In many scenarios, standalone calls are more practical. For example, an internal expense reimbursement system only needs to batch-recognize text on receipts, so it does not need to hand the entire workflow to a general-purpose conversational model. Separating tools allows teams to choose each one as needed, reduces coupling between modules, and makes it easier to replace any single component.

    3. Interface Formats and Migration Cost

    Mainstream services typically offer several interface formats, commonly message-based, response-based, and chat completion-based. Existing team code is often built on different request formats, so supporting multiple formats can noticeably reduce migration costs. When evaluating a service, focus on three things:

    1. Where the tool-calling switch sits in the request, and whether it requires extra permissions or a specific model version.
    2. Whether the response includes complete citation sources, original links, and timestamps, so the interface can attribute information to its sources.
    3. How intermediate tool-call states appear during streaming output, and whether they affect front-end interaction logic.

    Follow each service’s official documentation for specific field names. Before launch, adapt the code based on real response samples rather than assumptions.

    4. Cost Model: Tool Fees on Top of Token Fees

    This is the part teams most often underestimate. Most pay-as-you-go services bill in two parts:

    • Model token fees: Calculated from the number of input and output tokens.
    • Tool call fees: Priced separately by search calls, page reads, document pages, speech duration, character counts, and similar units.

    These charges add up. The cost of a single request depends on more than answer length. For a question that uses deep reasoning and allows web search, the model may issue several searches in sequence, and each search may trigger several page reads. The number of calls can vary considerably with question complexity.

    Use the following formula to estimate the cost of a single request:

    Cost per request = input tokens × input price + output tokens × output price + search calls × price per search + page reads × price per read

    Search and read counts cannot be known in advance, so their distribution must come from sampling real traffic. The example code below is illustrative. Replace the prices with values from the official pricing page:

    1. def estimate_cost(samples, price):
    2. """
    3. samples: List of request records. Each record contains the input_tokens,
    4. output_tokens, search_calls, and fetch_calls fields.
    5. price: Dictionary of unit prices, all in the same currency unit.
    6. """
    7. total = 0.0
    8. for s in samples:
    9. total += s["input_tokens"] * price["input_per_token"]
    10. total += s["output_tokens"] * price["output_per_token"]
    11. total += s["search_calls"] * price["search_per_call"]
    12. total += s["fetch_calls"] * price["fetch_per_call"]
    13. return total / len(samples) # Average cost per request

    After you get the average, also look at the P90 and P99 percentiles. A small number of heavy calls can drive up the overall bill, so looking only at the average can underestimate risk.

    5. Stress Testing: Measure Call Counts First, Then Decide the Product Design

    If you plan to build this type of capability into a user-facing product, run three types of tests before launch:

    1. Feature coverage testing: Build a test set that covers time-sensitive questions, multi-hop reasoning questions, obscure questions, and questions with no answer. Observe how often tools are triggered and how many times.
    2. Cost distribution testing: Measure the average, P90, and P99 cost per request to determine whether costs could run out of control.
    3. Concurrency and latency testing: Tool calls increase end-to-end latency, so verify timeout settings, retry policies, and fallback plans.

    Based on the results, you can choose among several control strategies: set a maximum number of tool calls per request, rate-limit high-frequency users, or enable web search only when users explicitly request it.

    6. Safety and Compliance Obligations for External Services

    When you provide model capabilities to external users, you typically take on content safety responsibilities, including:

    • Running content safety checks on inputs and outputs to block illegal and harmful information.
    • Completing any model or algorithm registration or filing that applicable regulations require in the jurisdictions where the service operates.
    • Labeling generated content and clearly informing users that AI produced it.
    • Retaining necessary logs and establishing a process for handling complaints.

    Platform security features can serve as a foundation, but they do not replace the compliance responsibilities of the business. In web-connected scenarios, search results and web content come from varied sources, so product-level source notices and risk warnings are especially important.

    7. Selection Recommendations

    When deciding whether to adopt built-in tools, teams can assess four dimensions:

    • Development speed: If the team lacks engineering experience with search and crawling, built-in capabilities can shorten the time to launch.
    • Cost predictability: If traffic is high and call patterns are stable, self-built retrieval and crawling components may cost less and be easier to forecast.
    • Data boundaries: When sensitive data is involved, confirm that its transmission and retention meet internal requirements.
    • Replacement difficulty: Wrap tool calls in your own abstraction layer so business code does not depend on any one provider’s response format.

    Built-in tools lower the barrier to integration, but they do not eliminate cost and compliance issues. Treat them as components that need quantitative evaluation. Measuring before deciding is the safer approach.