LLM Application API Opening: How to Replicate a Full AI Assistant
This article explains the shift from model APIs to application-level APIs, where retrieval, deep reasoning search, file input, link reading, and voice capabilities are exposed as composable tool interfaces. It breaks down five new capabilities plus a safety switch, shows sample code, and outlines a four-layer architecture, cost and performance strategies, and security, compliance, and observability practices for building a production-ready AI assistant.
1. From Model APIs to Application APIs: A Shift in How Capabilities Are Delivered
Over the past two years, developers have mainly called large language models through text completion endpoints, passing in a prompt and receiving a block of text in return. This model solves the “generation” problem but not the “application” problem. Real users do not type a single prompt. They paste a table, upload a several-hundred-page document, drop in a link, ask a question by voice, and follow up with “what was the third source you just cited?”
A platform recently integrated the web search, deep reasoning search, file input, and link reading capabilities from its assistant application into its existing API, and additionally opened standalone tool endpoints for retrieval, web crawling, optical character recognition, speech recognition, and speech synthesis. The official statement is that developers can use these to replicate the complete application one-to-one. Setting the specific brand aside, the essence of this move is a shift upward in the delivery unit: from “delivering a model” to “delivering application capability components.”
For developers, this brings three direct changes:
- Lower integration cost: instead of stitching together retrieval services, parsing services, voice services, and prompt orchestration themselves, developers can now enable them through parameter switches.
- Composability: tool endpoints can be called on their own or combined with model orchestration, fitting use cases from simple Q&A to complex agents.
- Better consistency: the official demo application and the open APIs come from the same source, so the interaction experience developers replicate is close to the official product, reducing the debugging cost of “results that don’t line up.”
2. Capability Breakdown: Five New Capabilities and One Safety Switch
1. Web Search (Non-Thinking Mode)
With the retrieval tool parameter enabled, the model can automatically launch web or image searches based on the question in normal conversation mode and attach cited sources in the answer. One engineering note: cited sources are the anchor of credibility and must be fully rendered by the frontend, not replaced by generated text alone.
2. Deep Reasoning Search (Thinking Mode)
In reasoning mode, the model can autonomously launch searches and read links during multi-step reasoning, using retrieval results as intermediate conclusions to keep moving forward until a complete answer is formed. This “think and search at the same time” pattern suits time-sensitive questions and questions that need cross-validation, at the cost of higher latency and more tool calls.
3. File Input
Layout documents, office documents, and images are supported. The model can perform plain text extraction or mixed text-and-image parsing, and the parsing result is added to the conversation context. Practical advice: chunk and summarize large files first, then bring them into the conversation, so the context is not crowded out by ineffective content.
4. Link Reading
With the link reading tool enabled, the model can automatically detect URLs in messages, crawl the content, and answer with context. This is the lowest-cost way to bring external knowledge into a conversation, but it must be paired with fallback handling for crawl failures and content length truncation.
5. Model Safety
Developers can enable a safety check parameter to run basic risk review on inputs and outputs and return a refusal flag when a risk is hit. Safety is not optional, especially when the application serves the public.
3. API Shapes and Sample Code
These capabilities typically cover three mainstream API styles: chat completion style, message orchestration style, and response style. Taking “enable web search” as an example, the sample code is below (parameter names are subject to the official documentation):
resp = client.chat.completions.create(model="your-model-name",messages=[{"role": "user", "content": "Look up this week's key industry updates and cite sources"}],tools=[{"type": "web_search"}], # Enable web search)print(resp.choices[0].message.content)
To “reason and search at the same time,” stack the same tool parameter in thinking mode. If you only need to crawl a specific link, call the web crawling tool separately and splice the result into the context:
page = tools.read_url("https://example.com/article")prompt = f"Answer the question based on the following content: {page}\nQuestion: What is the author's core conclusion?"
4. Architecture Design: Make Tool Calls a Controllable Pipeline
A production-ready replication plan is best split into four layers:
- Access layer: unified authentication, rate limiting, and logging, with model calls and tool calls placed behind the same gateway.
- Orchestration layer: intent recognition decides which path to take: direct answer, retrieval augmentation, deep reasoning, or file parsing, avoiding high-cost paths for every request.
- Tool layer: retrieval, crawling, recognition, and voice capabilities are wrapped as internal services with unified timeouts, retries, and degradation.
- Presentation layer: cited sources, file cards, voice controls, and refusal flags all need explicit UI rather than silent failure.
The key design principle is “use tools on demand.” Example strategy:
if the question contains time-sensitive keywords or the user asks for sources: take the retrieval pathelif an attachment exists: take the file parsing pathelif a URL is present: take the link reading pathelse: generate directly
5. Cost and Performance: Budget for Tool Calls
Expanded capabilities usually bring two kinds of billing: model token fees and tool call fees, with the latter settled by the actual tool types called and usage. So the focus of cost optimization is not prompt length but the “tool trigger rate.”
- Set trigger thresholds and caching: high-frequency repeated questions hit the cache and skip retrieval.
- Limit retrieval rounds and crawl counts to avoid unlimited expansion in deep reasoning mode.
- Prefer plain text extraction for small files and enable mixed text-and-image parsing only when necessary.
- Enable voice capabilities on demand, with recognition and synthesis metered separately, avoiding an always-on full pipeline.
On the performance side, add streaming responses, parallel tool calls, and timeout circuit breaking, and use logging services and monitoring alerts to observe time to first token, tool failure rate, and refusal rate.
6. Security, Compliance, and Observability
- Two-way input and output review: enable the safety check parameter and return a clear refusal flag when a risk is hit.
- Crawl content isolation: treat external web content as untrusted data and apply prompt injection protection and length truncation.
- Verifiable citations: keep source snapshots for later auditing.
- Full-chain tracing: string model calls and every tool call into one trace ID to locate whether a wrong answer came from retrieval or generation.
7. Conclusion
Opening up application-layer APIs turns “replicating a complete AI assistant” from an engineering challenge into a configuration and orchestration problem. The real competitive edge for developers has shifted from “can you connect the capabilities” to “can you orchestrate tool calls accurately and cheaply.” In general technical practice on platforms such as Baidu AI Cloud, the combination of model services, object storage, message queues, logging services, and monitoring alerts is likewise a common foundation for bringing this kind of application to production.
