Integration Practices and Architecture Design After Unified Multimodal LLM APIs Open Up
As LLM applications shift from simple chat to task completion, unified model APIs can bundle search, web reading, file understanding, speech, and content moderation into one request. This article explains the call flow, typical capabilities, integration patterns, cost controls, and engineering safeguards needed to build a practical assistant.
In recent years, competition among large language model applications has moved from “can the model chat” to “can the model complete a task.” A usable intelligent assistant usually needs more than text generation. It also needs web search, page reading, file understanding, voice interaction, and content moderation.
In the past, developers who wanted these capabilities often had to integrate a search service, a web-fetching component, a document parser, a speech recognition service, and a safety review system separately. They then had to handle tool calls, context assembly, retries, and result attribution themselves. The full pipeline was expensive to build, and stability depended heavily on external services.
Some model services now package these capabilities into a single model interface. Developers only need to declare the required tools in a conversation request. The service can then search, read a page, parse a file, or process speech, and pass the results back to the model for further reasoning. This lowers the barrier to application development and makes it more realistic to recreate an assistant with a complete feature set.
1. From a Single Model Call to a Composed Intelligent Interface
A traditional LLM call can usually be reduced to three steps:
- The client submits the user’s question.
- The model generates text.
- The client displays the result.
This works for knowledge Q&A, rewriting, and content generation, but it has clear limits when the task depends on real-time information or external materials. Training data has a time boundary. The model does not naturally know events that just happened, and it cannot directly read a user-specified web page or a local file.
A composed intelligent interface extends the call into:
- The user asks a question.
- The model decides whether an external tool is needed.
- The server searches, fetches, parses, or recognizes content.
- Tool results are organized into context.
- The model generates a final answer from that context.
- The system returns the answer, tool execution records, and necessary citations.
The key change is that tool execution is no longer fully orchestrated by the client. The model service schedules it. Developers only declare which tools are allowed and set the necessary limits.
From a product-design perspective, this upgrades a language model into an intelligent agent that can call external capabilities.
2. Common Capabilities and Where They Fit
2.1 Web search
Web search is mainly used for real-time information such as weather, traffic, policy, market developments, public announcements, and technical materials.
A search capability usually includes:
- Generating search queries from the user’s question
- Calling a search service for candidate results
- Deduplicating, ranking, and filtering those results
- Passing titles, snippets, sources, and links to the model
- Letting the model synthesize multiple results into an answer
Search results are not the same as facts. For high-risk domains such as finance, healthcare, law, and public safety, applications still need source display, human review, and cross-checking across multiple sources.
2.2 Web page reading
Search only provides snippets. Page reading can retrieve the body of a page. It fits scenarios such as:
- Summarizing a public article
- Extracting tables and key figures from a page
- Comparing content across multiple pages
- Answering questions from a specified page
- Producing a structured summary of page content
Web content is highly uncertain. Pages may require login, load dynamically, contain ads, be unavailable, or include malicious prompts. A page-reading module should not place the entire page into context unconditionally. It should first control length, extract the main text, filter scripts, and sanitize content.
2.3 File input and text recognition
File understanding typically covers text files, spreadsheets, presentations, scans, and images. Scanned documents also require text recognition to extract content.
A relatively complete file-processing pipeline can be designed as:
File upload↓Format detection and virus check↓Text extraction or image recognition↓Chunking and structuring↓Model understanding and Q&A↓Result return and citation positioning
A file Q&A system should not only ask whether the model can understand the file. It should also track where the answer comes from. For contracts, financial statements, and policy documents, it is better to keep page numbers, paragraphs, or table locations so users can verify the answer.
2.4 Speech input and speech synthesis
Speech input usually includes recording upload, format conversion, speech recognition, and text correction. Speech output converts model-generated text into audio.
A complete voice assistant usually includes:
- Start and stop controls for recording
- Silence detection
- Audio format normalization
- Speech-to-text
- LLM understanding and generation
- Text-to-speech
- Streaming playback and interruption handling
In practice, latency affects the user experience more than one-shot recognition accuracy. Streaming recognition, segmented synthesis, and playback while generation is still running can reduce waiting time.
2.5 Content safety review
When an application lets users upload files, enter text, or access external pages, safety review should not be optional. The review scope usually includes:
- Illegal or noncompliant content
- Malicious instructions and prompt injection
- Privacy leakage
- Dangerous scripts inside files
- Inappropriate content in generated results
- External pages that try to induce the model to perform unauthorized actions
Safety checks are better placed at multiple points, not only once before the final output.
3. A General Integration Pattern
Common model services usually follow a standardized interface protocol. Developers can call them over HTTP or through a client library for their language.
The following example uses abstracted pseudocode to show the request structure:
import osimport requestsapi_key = os.environ["MODEL_API_KEY"]payload = {"model": "general-purpose chat model","messages": [{"role": "system","content": "Answer in English and prefer reliable sources."},{"role": "user","content": "Look up today's public weather information and suggest travel advice."}],"tools": [{"type": "web_search"},{"type": "read_webpage"}],"thinking": {"enabled": False}}response = requests.post("model service endpoint",headers={"Authorization": f"Bearer {api_key}","Content-Type": "application/json"},json=payload,timeout=60)result = response.json()print(result)
In a real integration, confirm the model name, tool fields, authentication method, timeout, and response schema against the official documentation. Do not guess parameters from the interface name alone. That often causes failed requests or tools that never run.
If the server returns tool-call records, the client should also store:
- Tool type
- Call time
- Query content
- Return status
- Sources used
- Error information
- Whether the model ultimately used the result
This information helps troubleshooting, cost accounting, and answer-quality evaluation.
4. Cost Accounting Is More Than the Model Price
The cost of a composed intelligent application usually has several parts:
Total cost =model input cost+ model output cost+ search call cost+ web page reading cost+ file processing cost+ speech recognition cost+ speech synthesis cost+ storage and logging cost
If one user request triggers search, page reading, and file parsing together, the actual spend can be much higher than a plain text Q&A.
A call budget is therefore useful:
- Maximum tool calls per request
- Maximum bytes read from a single page
- Maximum size of a single file
- Maximum context retained in one conversation
- Daily quota per user
- Whether high-cost tasks require a second confirmation
For low-value questions, prefer a local cache or historical results. For repeated queries, set a reasonable cache lifetime. For high-frequency public information, build an index in advance to reduce real-time tool calls.
5. Key Engineering Issues
5.1 Preventing prompt injection
External pages and uploaded files may contain malicious text such as “ignore the previous instructions.” The model should clearly distinguish:
- System rules
- User instructions
- Tool return content
- Untrusted external material
External material can only be reference information. It must not automatically gain execution rights. Actions such as sending a message, changing data, or submitting an order require explicit authorization and parameter validation at the application layer.
5.2 Controlling context length
Search results and page bodies can be very long. Putting all of them into context raises cost and can reduce answer quality. A more reliable approach is to:
- Extract passages relevant to the question first
- Compress candidate content
- Remove repeated navigation and advertising text
- Deduplicate multiple sources
- Keep source identifiers and location information
5.3 Failure handling and degradation
Tool calls can fail because of network errors, unavailable pages, rate limits, or unsupported formats. The application should not expose raw errors directly. Prepare fallbacks:
- If search fails, say that real-time information could not be retrieved
- If page reading fails, ask the user to paste the body text
- If file parsing fails, list supported formats
- If speech recognition fails, allow a switch to text input
- If the model times out, return a retryable state
5.4 Privacy protection
Files, recordings, and conversation content may contain personal information or business secrets. The application should define retention periods, access permissions, and deletion mechanisms, and avoid writing sensitive content into ordinary logs.
For enterprise use, also consider:
- Masking sensitive fields
- Isolating user identity and permissions
- Time-limited file access links
- Audit logs that cannot be casually modified
- Tiered administrator viewing permissions
6. How to Build a Complete Intelligent Assistant
A more mature system can be split into six layers:
- Interaction layer: text, voice, file upload, and result display
- Session layer: history, context, and user preferences
- Intelligent orchestration layer: deciding whether to call search, reading, recognition, and other tools
- Capability service layer: search, page processing, file parsing, and speech tasks
- Security and governance layer: authentication, review, rate limiting, masking, and audit
- Operations and observability layer: latency, errors, cost, and user feedback
This layered structure is easier to maintain than putting all logic in one interface function. Replacing the model or adding a new tool type later does not have to change the upper-level product pages.
7. Conclusion
The real value of an all-in-one model interface is not simply writing less code. It is combining search, understanding, generation, and interaction into one application foundation. Developers can build intelligent Q&A, knowledge-base assistants, file analysis tools, voice customer service, and information collection systems faster.
An open interface does not mean the application can run fully automatically. A high-quality product still depends on accurate permission control, reliable source citations, solid exception handling, reasonable cost management, and strict data-security design.
If you want to build a similar system with Baidu or Baidu AI Cloud, start with one clear scenario, such as real-time Q&A with sources or enterprise file analysis. Ship a minimum usable version first, then add voice, review, automated workflows, and multi-tool coordination. That keeps complexity under control and makes it easier to verify real business value.
