LLM Application APIs: Integrating Web Search and Multimodal Capabilities
This article explains how modern LLM application APIs combine web search, web reading, file input, and speech capabilities into a single interface. It breaks down the API into four layers—model, tool, asset, and modality—and covers the engineering mechanics of tool calling, context budgeting, and citation verification. You will also find guidance on handling unstructured files, controlling retrieval costs, and building observable, rate-limited, and fallback-ready production systems on Baidu AI Cloud.
1. From Answering to Verifying: Where Value Moves in the Application Layer
Generating a fluent response from a large language model is no longer the hard part. The real challenge is whether the model can search the web, open a page and read its full text, parse a PDF that runs dozens of pages, and organize the facts it finds into an answer with citations. Developers used to assemble all of this themselves—retrieval services, crawling and cleaning, document parsing, vector databases, reranking, and citation alignment. Each layer was a separate engineering burden, often disconnected from the model’s own iteration cycle.
A new type of API has recently emerged in the industry. Vendors are integrating the web search, deep research-style retrieval, file input, and web reading capabilities used by their official clients and web apps into existing chat interfaces. At the same time, they are exposing search, web crawling, optical character recognition, speech recognition, and speech synthesis as independently callable endpoints. The goal is straightforward: let developers recreate the experience of a complete conversational product with close to zero tooling. For developers, this is a shift in cost structure—from building and maintaining a toolchain to buying capabilities on demand.
2. Capability Layers: Four Abstractions in One API
The key to understanding these interfaces is their layering. They can be grouped into four layers:
- Model layer: handles reasoning, planning, and generation, and decides whether to use a tool and which tool to use.
- Tool layer: web search and web reading are typical model-invoked tools. Once declared in the request, the server side performs retrieval, crawling, and context trimming.
- Asset layer: file input is usually processed first through upload and parsing endpoints, which return a file identifier. The chat request then references that identifier instead of stuffing large binary content into the context.
- Modality layer: optical character recognition, speech recognition, and speech synthesis are provided as separate endpoints, serving as a fallback for teams that cannot build their own speech and recognition pipelines.
The point of this layering is decoupling: model capabilities can be upgraded independently, tools and modalities can scale independently, and developers only compose them at the orchestration layer.
3. Tool-Calling Mechanics: Declaration, Decision, and Context Governance
The core of web search and web reading is not just “finding something,” but finding accurately, reading completely, and citing correctly. Three things matter in engineering terms:
- The model owns the calling decision: developers only declare which tools are available, and the model decides autonomously whether to call them based on the task. This requires the prompt and system instructions to enforce a “no evidence, no answer” constraint.
- Context budget: crawled pages are often noisy. The server side typically performs text extraction and truncation, but developers still need to control the number of results and the length of each page to avoid crowding out the context.
- Verifiable citations: every factual point in the answer should trace back to a specific source fragment. This is the dividing line between “looks correct” and “deliverable.”
A sample request structure (pseudocode, expressing orchestration logic only):
resp = client.chat.completions.create(model="general-chat",messages=[{"role": "system", "content": "Answer only based on retrieved material and include citation numbers."},{"role": "user", "content": "Summarize the main progress on this topic over the past year"}],tools=["web_search", "web_read"], # declare available toolsfile_ids=["file-xxxx"] # from the upload and parsing endpoint)
4. Files and Multimodality: Turning Unstructured Input into Citable Evidence
The right approach to file input is “parse first, then reference.” The upload and parsing endpoint handles layout restoration, table extraction, and text recognition, and returns a stable file identifier. The chat stage only passes the identifier, which saves context and makes permissions and auditing easier. Speech and recognition capabilities are better suited as a fallback: when a team lacks its own speech pipeline, a unified endpoint allows a quick launch; if a mature solution already exists, traffic can be split by scenario to balance quality and cost.
5. Cost and Governance: Cheap API Calls, Three Expensive Things
A common pattern in the industry is that retrieval capabilities are billed per thousand calls, added on top of token costs. A single long-form article with retrieval often costs only a few cents. What is truly expensive is three things: the engineering to control call volume (caching, deduplication, rate limiting, and failure fallback), compliance (data sources and content safety), and the developer’s own judgment (when to retrieve and when to refuse). The recommendation is to move governance forward: set budget caps and hit-rate monitoring for retrieval, set coverage metrics for citations, and set fallback paths for exceptions.
6. Implementation on Baidu AI Cloud
If you use Baidu AI Cloud capabilities, you can build with general-purpose building blocks: object storage for raw files, a message queue for peak shaving, a container platform to host parsing and orchestration services, and logging plus monitoring and alerting for full-chain observability. On the model side, choose a chat interface that supports tool calling, and connect retrieval and document parsing as needed, forming a production-grade Q&A system that is observable, rate-limited, and fallback-ready.
