A Practical Guide to LLM Application API Capabilities: Architecture, Tool Orchestration, and Cost Control
This article explains how vendors are exposing the full capability stack behind their official LLM chat products through unified APIs, and what that means for developers. It breaks down five common extension capabilities—web search, deep thinking search, file input, link reading, and model safety—along with their underlying principles and engineering considerations. You will find a reference architecture, practical prompt and tool orchestration techniques, a unit economics model for pricing tool calls, and a compliance checklist for shipping such applications to external users.
1. Technical Background: From a Single Chat Product to Orchestratable Capabilities
Over the past two years, competition among LLM products focused mainly on model parameters and benchmark scores. More recently, the industry has shifted: vendors are opening up the full capability stack behind their official chat applications to developers through a unified interface system.
The essence of this change is decoupling the product form from the model capabilities. The official application is just one reference implementation of a capability combination; developers can re-orchestrate those capabilities around their own business needs, reproducing or even surpassing the original product experience.
For developers, this brings three direct benefits:
- No redundant engineering: foundational modules such as retrieval, file parsing, speech processing, and content moderation no longer need to be built in-house.
- High composability: capabilities are mounted as “tools” and can be toggled per scenario.
- Controllable iteration cost: when the model side is upgraded, the application side can gain new capabilities without major rework.
It is worth emphasizing that these capabilities are usually not something the model “possesses natively.” They are injected through a tool-calling mechanism at the interface layer. Understanding this is a prerequisite for sound architecture design.
2. Capability Breakdown: Common Principles of Five Extension Capabilities
2.1 Web Search
In non-thinking mode, once a retrieval tool is enabled, the model decides based on the semantics of the question whether to launch a web or image search. The retrieval results are then used as context for generation, with citation sources attached. From an engineering perspective, this inserts an “intent detection + query rewriting + result reranking” pipeline between the model and the external retrieval service.
Implementation notes:
- Query rewriting quality determines recall quality. It is advisable to normalize colloquial user questions on the application side.
- Citations must be returned and displayed. This is both a trust issue and a compliance requirement.
- For time-sensitive questions (prices, policies, sports events), retrieval should be enabled by default.
2.2 Deep Thinking Search
In thinking mode, the model enters a multi-step reasoning state and can autonomously decide “when to search, what to search, and which sources to read” within the reasoning chain, forming a closed loop of “reason—retrieve—reason again.” It suits complex tasks such as open-ended research, competitive analysis, and technology selection.
The difference from basic retrieval is that basic retrieval is a single-turn tool call, while deep thinking search is multi-turn, traceable, agent-like behavior. As a result, both latency and the number of calls increase, so timeout and budget caps are needed.
2.3 File Input
Supported formats include documents, spreadsheets, presentations, and images. After plain text extraction or mixed text-and-layout parsing, the content is assembled into the context. The key engineering issue here is the “context budget”: long documents must be chunked, summarized, and retrieved on demand; otherwise they will crowd out the conversation window and drive up costs.
Recommended pipeline:
Upload -> format detection -> text/layout parsing -> chunking and vectorization-> retrieval -> reranking -> prompt assembly -> model generation -> citation tagging
2.4 Link Reading
Once a link-reading tool is enabled, the model can automatically detect URLs in messages, fetch the page body, and answer in combination with the context. On the application side, you should keep a whitelist/blacklist policy and a maximum page-fetch limit to avoid having performance dragged down by malicious links.
2.5 Model Safety
Once the safety check parameter is enabled, the service provider performs basic moderation, reviewing both input and output, and returns a refusal flag when a risk is hit. If you offer services externally, you need to enable this parameter and take on obligations such as content moderation, LLM registration, and generated-content labeling. This is a compliance step that cannot be skipped. It is best implemented uniformly at the gateway layer rather than scattered across business code.
3. Reference Architecture: A Deployable Combination Design
Client-> API gateway (authentication, rate limiting, auditing, content labeling)-> Session orchestration layer (intent routing, tool toggles, budget control)-> Model interface (three forms: Messages / Responses / Chat Completions)|- retrieval tool|- link reading tool|- file parsing pipeline|- speech recognition / synthesis-> safety check and logging services, monitoring and alerting
Design points:
- Bind tool toggles to scenarios. Make “whether to retrieve” and “whether to use deep thinking” configuration items delivered per business line, avoiding global hardcoding.
- Budget and circuit breaking. Set tool call count and cost caps per session; when exceeded, degrade to a pure model answer.
- Observability. Log a summary of the input, latency, and result status of each tool call, and connect to logging and monitoring/alerting services. This makes it easier to diagnose “slow answers” and “off-target answers.”
- Statelessness. Externalize session state to a cache or object storage so the container platform can scale horizontally.
4. Practical Tips for Prompt and Tool Orchestration
- Define tool boundaries clearly. Spelling out in the system prompt “when retrieval is mandatory and when it is forbidden” can significantly reduce invalid calls.
- Use structured output. Require the model to return conclusions and citations in a fixed structure, making frontend rendering and post-processing easier.
- Two-stage generation. First produce a bullet outline, then expand point by point and add citations. This improves factual consistency in long answers.
- Fallback on failure. When fetching or parsing fails, explicitly tell the user “this source is unreadable” instead of letting the model guess freely.
Sample prompt snippet:
You are a rigorous technical assistant.Rules:1) For time-sensitive information, you must retrieve first and provide sources;2) Mark content that cannot be verified as "unconfirmed";3) Output structure: conclusion / evidence / source list.
5. Cost Assessment: Factoring Tool Calls into the Unit Economics Model
Extension capabilities are usually billed separately on top of token fees. Common pricing dimensions include: text and image search billed per call, web page fetching billed per call, text recognition billed per page, speech recognition billed by duration, and speech synthesis billed by character. Prices vary across vendors, but the pricing “dimensions” are highly consistent, which is enough to support cost modeling.
Recommended practices:
- Build a unit economics model: cost per session = token cost + Σ(tool call volume × unit price).
- Cache high-frequency scenarios; reuse retrieval results by query fingerprint.
- Summarize long documents locally before uploading to reduce per-page recognition overhead.
- For speech scenarios, use “silence detection + segmentation” to reduce duration-based billing.
6. Compliance and Obligations Checklist
When offering application services externally, you typically need to: enable safety checks, establish content moderation and appeal mechanisms, fulfill LLM-related registration, prominently label generated content, and retain necessary logs. These obligations are independent of the specific cloud vendor and are common industry requirements. It is advisable to include them as checklist items during the architecture review stage.
7. Conclusion
The significance of capability openness is not to let developers “clone an official application,” but to turn retrieval, parsing, speech, and moderation—the “foundation”—into callable modules. Real differentiation comes from your understanding of the scenario, the way you organize context, and your fine-grained control over cost and compliance. With general cloud product capabilities from Baidu AI Cloud (such as object storage, message queues, container platforms, logging services, and monitoring/alerting), this architecture can be deployed quickly and run stably.
