Technical Practice: Opening Up Application-Layer Capabilities in Large Models

    This article examines the shift from "model as API" to "capability as API" in large model application development. It outlines the two-layer structure of opened application-layer capabilities—built-in tools enabled through tool declarations and standalone atomic APIs—and explains the engineering value of server-side orchestration. Using an enterprise knowledge base Q&A scenario, it shows how a hybrid "internal-first, external-second" retrieval route helps RAG systems go beyond document boundaries. It also covers multimodal and voice pipeline implementation, security, cost management, and observability, and recommends starting with a small-scale rollout backed by offline evaluation sets and online metrics.

    1. From “Model as API” to “Capability as API”

    Over the past two years, the basic pattern for building large model applications has been: pick a model API, then build all the surrounding capabilities yourself on the application side. You set up your own crawler and index for retrieval, wire in your own parser for document processing, find your own transcription and speech synthesis services for voice, and run outputs through a moderation layer. The result is that model capability accounts for only a small part of the total engineering effort, with a large amount of time consumed by the “glue layer.”

    A clear trend has recently emerged in the industry: vendors are opening up the application-layer capabilities that previously ran only inside their own apps and web front ends, exposing them through official APIs and making them compatible with several widely used request protocols at the same time. This means a shift in the division of engineering labor—the model provider handles server-side orchestration (search, opening web pages, reading files, moderation), while developers only declare the tools they need in the request and the server completes the rest of the flow.

    This shift delivers three engineering benefits. First, integration cost drops from weeks to hours. Second, behavioral consistency improves, because the application side and the official front end use the same capability implementation, making results predictable. Third, maintainability improves, because capability upgrades happen on the server side and the application does not need to be reworked to follow along.

    2. Capability Overview: A Two-Layer Structure of Built-In Tools and Standalone APIs

    Opened capabilities typically form a clear two-layer structure.

    The first layer is built-in tools, enabled through tool declarations in a chat request, with the server deciding autonomously during inference when to call them:

    • Web search: when the model determines that external information is needed, it automatically retrieves web pages or images and cites sources in the answer;
    • Deep-thinking search: in reasoning mode, the model can repeatedly search, open web pages, and locate information within pages during its chain of thought;
    • Link reading: URLs in the user message are automatically opened and the main text is extracted;
    • File input: upload a PDF, Word, PPT, Excel, e-book, code file, or image first to obtain a file identifier, then reference it in the message;
    • Content safety: the server moderates the input and the complete output, and refuses to answer when a risk is detected.

    The second layer is standalone APIs, which atomize the underlying capabilities so they can be embedded into agents or pipelines: web search (returns results, summaries, and relevance/authority scores), web page fetching (returns Markdown main text), text recognition (returns text and position information), speech recognition (multilingual transcription), and speech synthesis (multiple voices, with streaming playback support).

    At the protocol layer, the three mainstream formats—Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions—are typically supported simultaneously, keeping migration costs low.

    Illustrative call (pseudocode, structure only):

    1. resp = client.chat(
    2. model="<model-id>",
    3. tools=[{"type": "web_search"}], # declare a built-in tool
    4. messages=[{"role": "user", "content": "What changed in the latest version?"}]
    5. )
    6. print(resp.content, resp.citations) # main text + source citations

    3. Scenario Practice: Taking RAG Knowledge Bases Beyond the “Document Boundary”

    Take enterprise knowledge base Q&A as an example. The original pain point is very typical: the system can only answer based on documents already ingested, and when it encounters the latest release notes, industry news, or upstream official documentation, it either “cannot answer” or hallucinates.

    The approach is to introduce a hybrid retrieval route that goes “internal first, external second”:

    1. First perform intent and confidence assessment; if a high-confidence fragment is matched in the knowledge base, answer directly;
    2. If confidence is insufficient or the question contains time-sensitive keywords, call the search API to obtain candidates, then use the fetch API to convert candidate pages into Markdown;
    3. Chunk and rerank the main text, assemble the context, and have the model generate an answer with mandatory citations;
    4. Feed high-value external content back into the knowledge base to form a closed loop of knowledge accumulation.
    1. def answer(q):
    2. hits = vector_search(q)
    3. if hits and hits[0].score > 0.75:
    4. return generate(q, hits)
    5. results = search(q, top_k=6)
    6. docs = [fetch(r.url) for r in results if r.authority > 0.5]
    7. return generate(q, chunk_and_rerank(docs), require_citation=True)

    Four points deserve particular engineering attention: verifiable citations (every conclusion can be traced back to a URL or document fragment), compliant fetching (respect robots rules and site terms, control concurrency and timeouts), context budget (compress and truncate long main text), and failure fallback (when the external path is unavailable, state so clearly rather than fabricating).

    4. Implementation Points for Multimodal and Voice Pipelines

    Document and OCR capabilities are well suited to scanned copies, contracts, and report screenshots, and the returned position information can be used for front-end highlighting and source tracing. The voice pipeline can build a “speak to search” entry point: speech recognition transcription → retrieval Q&A → speech synthesis playback, which fits in-car, customer service, and accessibility scenarios. In practice, you need to handle dialects and noise, segment long audio, manage jitter buffering for streaming playback, and match synthesized voices to the scenario.

    5. Security, Cost, and Observability

    Content safety should be enabled by default rather than added as an afterthought; at the same time, apply secondary confirmation and least-privilege constraints to high-risk intents. For cost management, account for “built-in tools” and “standalone APIs” separately by call volume, and set up a cache layer (reuse results for identical queries), batch uploads, and result persistence to disk to avoid duplicate billing. For observability, it is recommended to instrument uniformly: tool call success rate, average retrieval latency, citation hit rate, and refusal rate, combined with logging services and monitoring alerts to form a closed loop. If an enterprise already uses general cloud products such as object storage, message queues, container platforms, and log monitoring from Baidu AI Cloud, it can host fetch artifacts, task queues, and metric collection directly, reducing the burden of self-built operations.

    6. Conclusion

    The essence of API-izing application-layer capabilities is moving the focus of “building applications” from infrastructure back to business logic. What developers really need to refine is the retrieval routing strategy, context engineering, citation credibility, and the evaluation system. It is recommended to start with a small-scale canary rollout, establish dual-track validation with an offline evaluation set and online metrics, and then gradually expand the scope of capability integration.