Large Model Application APIs Open Up: How to Build Your Own AI Assistant

    This article explains the shift from model APIs to application APIs, where a full assistant capability stack is exposed as callable tools. It breaks down five core tool interfaces—web search, deep-thinking search, file input, link reading, and speech plus OCR—along with their engineering tradeoffs. It also covers the dual-track billing model, security and compliance requirements, and a step-by-step path to building a complete assistant with controllable cost and reliable safety.

    1. Background: The Leap from Model APIs to Application APIs

    Over the past two years, the mainstream way developers used large models was relatively uniform: assemble prompts and context, submit them to an inference endpoint in a single call, and then orchestrate any follow-up logic yourself. This works well for pure text tasks such as Q&A, summarization, and translation. But as soon as real-time information, long documents, rich media input, or multimodal output enters the picture, developers have to integrate a chain of peripheral capabilities—search, crawling, parsing, speech synthesis, and speech recognition—which significantly lengthens the engineering pipeline.

    Recently, a cloud vendor announced that it is opening the complete capability stack of its AI assistant product as APIs. This marks a move from “the model is the interface” to “the application is the interface.” The essential change is that the platform has standardized the capability components that used to be packaged inside its own product, letting developers enable corresponding parameters or call standalone tool interfaces to reach functional completeness close to the official app. For developers, this means building an assistant with web retrieval, deep reasoning, file understanding, link reading, and voice interaction no longer requires assembling the entire toolchain from scratch.

    It is worth stressing that this kind of opening is not a simple pile-up of capabilities. It decouples model inference from tool execution into two orchestrable layers. The model handles intent understanding and decision-making; tools handle deterministic execution; the two are connected through a unified message protocol. Understanding this layering is the prerequisite for all the engineering practices that follow.

    2. Capability Overview: A Technical Breakdown of Five Core Tool Interfaces

    2.1 Web Search: Embedding Retrieval into the Generation Pipeline

    In non-thinking mode, once the developer enables the web search tool, the model decides based on the semantics of the user’s question whether retrieval is needed, launches a web or image search, and attaches citation sources in the answer. The technical value is not just “adding real-time information.” It hands the retrieval decision to the model: no need to write keyword rules in advance, as the model constructs the query intent autonomously with the surrounding context.

    Three engineering points deserve attention. First, citation traceability must be preserved; it is both a trust guarantee and the basis for later auditing. Second, search results are untrusted external content and must be isolated from the system prompt to guard against prompt injection. Third, set caps on the number of results and text length so that low-quality content does not crowd out the context.

    2.2 Deep-Thinking Search: Autonomous Retrieval During Multi-Step Reasoning

    In thinking mode, the same search tool behaves quite differently: within a multi-step reasoning chain, the model repeatedly issues searches, reads links, and verifies intermediate conclusions, then advances to the next reasoning step until it forms an evidence set that can support a final answer. This is closer to how a research assistant works, and suits complex fact-checking, multi-source comparison, and long-chain analysis tasks.

    The cost is a double rise in latency and consumption. In practice, tier tasks by difficulty: route simple factual queries through non-thinking mode, enable deep-thinking search only for complex analysis, and set user expectations at the product layer that “this will take longer.”

    2.3 File Input: From Plain Text Extraction to Mixed Text-and-Image Parsing

    File input typically supports common formats such as documents, spreadsheets, presentations, and images, and offers two parsing granularities. Plain text extraction suits highly structured, text-heavy material. Mixed text-and-image parsing preserves layout and image information, and fits scanned files, chart-dense reports, and documents containing formulas.

    The key design on the calling side is “separate parsing from reasoning”: first complete file parsing to obtain normalized intermediate results, then decide whether to inject the whole thing into context or to summarize in chunks first. For very long documents, injecting everything is neither economical nor necessary; a two-stage strategy of summarize first, then ask follow-up questions, is usually more stable.

    A skeletal call looks like this (parameter names are illustrative; refer to the platform documentation for the actual ones):

    1. resp = client.chat.completions.create(
    2. model="<model_name>",
    3. messages=[
    4. {"role": "system", "content": "You are a rigorous analysis assistant; cite sources in your answers."},
    5. {"role": "user", "content": "Summarize the key risks in this quarterly report."}
    6. ],
    7. tools=[{"type": "file_parse"}], # enable file parsing
    8. stream=True
    9. )

    With the link reading tool enabled, the model can automatically detect URLs in the user’s message, fetch the page body, and answer with the surrounding context. It complements web search: search solves “not knowing where to look,” while link reading solves “already knowing which page to read.” Combined, they cover both “Q&A over given material” and “open-ended research.”

    Because fetching reaches the external network directly, be sure to configure a domain allowlist, timeout and retry limits, and response body size limits on the server side, and apply the same untrusted-content isolation to fetched material.

    2.5 Speech and OCR: Filling in Multimodal Input and Output

    Standalone speech recognition, speech synthesis, and text recognition interfaces let an app cover voice questions, spoken playback, and text extraction from images and scans. For engineering, streaming recognition is recommended to reduce first-token latency; on the synthesis side, unify voice and speaking rate configuration for product consistency; and retain the original text of both recognition and synthesis results for log troubleshooting and quality regression.

    3. Billing Model: How Tool Calls Change the Cost Structure

    This kind of opening usually adopts dual-track billing of “model token fees plus tool call fees,” with extended capabilities settled by the type and volume of tools actually invoked. This directly changes the shape of the cost curve: cost used to be driven mainly by input and output length, but now the number of searches, pages fetched, pages parsed, and minutes of speech are all independent cost variables.

    Cost governance therefore has to be moved forward into architecture design:

    • Add usage instrumentation per tool dimension, separating model consumption from tool consumption; otherwise the bill cannot be attributed.
    • Set a cache layer for high-frequency, low-value requests, reusing search and parsing results by content fingerprint.
    • Set a tool-call budget cap per session, degrading to a pure model answer with a user notice when exceeded.
    • During load testing, evaluate latency and cost per request together, so that experience is not optimized at the expense of gross margin.

    4. Security and Compliance: A Layer You Cannot Skip

    Platforms usually provide basic input and output risk-control parameters that return a refusal flag on a hit. But developers should be clear that this parameter is only a basic capability and does not constitute a complete compliance solution. Apps serving the public should also fulfill obligations such as content safety review, algorithm and model registration and filing, generated-content labeling, and retaining traceable call logs.

    On the technical side, three lines of defense are recommended: input review and prompt injection detection at the entry; isolation and cleaning of external search and fetched content during processing; and output review plus sensitive-information masking at the exit. Beyond these three lines, establish manual review and canary rollback mechanisms to handle sudden risky content.

    5. Implementation Advice: How to Replicate a Complete Assistant at Low Cost

    The recommended path is “get the loop working end to end first, then enhance layer by layer”:

    1. Connect the model and tools with a unified message protocol, and first implement single-turn Q&A with citation sources.
    2. Add file parsing to form a minimum viable chain of “upload, parse, summarize, follow up.”
    3. Layer on link reading and speech capabilities to complete multimodal interaction.
    4. Introduce session state management and persist tool call results in a structured store to support multi-turn context.
    5. Finally, add caching, budget control, monitoring and alerting, and logging services to form an operable loop.

    At the infrastructure level, object storage can hold files, a message queue can smooth traffic peaks, a container platform can host an elastic inference proxy, and logging plus monitoring and alerting services can provide observability. Baidu AI Cloud offers corresponding capabilities in these general cloud product categories and can serve as a reference for a foundation to build such an app.

    Overall, opening up application-layer APIs lowers the technical barrier of an AI assistant from “integrating a dozen services” to “enabling a few parameters.” The real competitive difference will shift from “whether you can build it” to three engineering fundamentals: whether cost is controllable, whether security is reliable, and whether the experience is stable.