Open-Capability APIs: A Developer’s Guide to Building AI Applications
As foundation model platforms expose application-level capabilities through APIs, developers can build customized AI products instead of relying solely on fixed interfaces. This guide explains how to combine web search, multi-step retrieval and reasoning, file parsing, webpage reading, and voice interaction into a complete, operable application. It covers capability orchestration, reference architecture, development workflows, session migration, evaluation, monitoring, security, and common use cases.
In the past, users who were dissatisfied with an application could usually only submit feedback and wait for a future release. As foundation model platforms begin exposing application-level capabilities through APIs, more teams and individuals can build their own intelligent applications on top of general-purpose interfaces.
The boundaries between product design, implementation, and end-user experience are becoming less distinct. An individual may act as the requirements owner, developer, and user at the same time. This article does not focus on any specific platform. Instead, it presents a general technical approach to designing and delivering a complete, operable AI application when capabilities such as web search, deep research, file parsing, webpage reading, and voice interaction can be called programmatically.
1. From Using Applications to Orchestrating Capabilities
The key change introduced by open application capabilities is not simply the availability of another chat endpoint. It is the ability to break down capabilities previously hidden behind a product interface into composable modules.
Developers can select combinations of capabilities according to the business scenario:
- Use web search when up-to-date information is required.
- Enable multi-step retrieval and reasoning for complex questions.
- Call file-parsing services to analyze documents.
- Use URL reading to extract and process webpage content.
- Add speech recognition and synthesis to provide a voice interface.
The value of this approach lies in capability alignment and reference implementations. When API capabilities are close to those available in mature applications, developers do not need to implement retrieval, parsing, session management, and related workflows from scratch. They can focus instead on business logic, data governance, and user experience.
If a platform also provides sample applications or open-source reference implementations, developers can study their session models, history import workflows, frontend-backend interactions, and error-handling patterns. This can significantly reduce the cost of getting started.
2. Capability Matrix and Composition Patterns
A complete intelligent application typically requires five types of capabilities to work together.
Web search: Addresses the time-sensitivity of model knowledge. Engineering considerations include query rewriting, result deduplication, summary compression, citation labeling, and fallback behavior when searches fail.
Deep research and retrieval: Connects query planning, multi-step retrieval, evidence synthesis, and answer generation. It is suitable for research, complex question answering, and decision support. Developers should avoid simply concatenating the results of a single search round and should instead design mechanisms for evidence selection and conflict resolution.
File parsing: Processes unstructured data such as PDFs, spreadsheets, and presentations. Important considerations include layout preservation, table extraction, chunking strategies, metadata retention, and sensitive-information filtering.
URL reading: Extracts webpage content, titles, publication dates, and other structured information, then standardizes them as evidence fragments alongside search results. The implementation must account for anti-crawling restrictions, irrelevant webpage content, and content safety.
Voice interaction: Connects speech recognition, dialogue generation, and speech synthesis into a low-latency workflow. This is useful for mobile applications, customer service, in-vehicle systems, and similar scenarios.
These capabilities should not be treated as simple additions. Developers should establish a capability orchestration layer that routes requests according to user intent and standardizes output formats, citation metadata, error codes, and billing metrics.
The following is illustrative pseudocode rather than a real API definition:
request = {"model": "<model identifier>","messages": [...],"capabilities": {"web_search": true,"multi_step_reasoning": true,"file_parse": true,"url_read": true,"speech": true},"session_id": "<session identifier>"}response = invoke_model_api(request)
For an actual integration, developers should follow the relevant platform documentation and avoid assuming parameter names or capability details that have not been officially defined.
3. Reference Architecture: Turning Capabilities into an Operable System
A layered architecture is generally appropriate:
- The access layer handles authentication, rate limiting, and protocol conversion.
- The capability orchestration layer manages intent recognition, capability routing, and fallback strategies.
- The session layer maintains context, conversation history, and user preferences.
- The data layer manages files, webpage snapshots, vector indexes, and audit logs.
- The observability layer collects traces, latency, error rates, and cost metrics.
Session management is easy to underestimate. A multi-turn conversation should distinguish between short-term context, long-term memory, and business facts. The entire conversation history should not be inserted into every prompt indefinitely.
For file and URL reading, retain the source, fragment location, and parsing timestamp. This supports citation and traceability. Voice workflows should include timeouts, segmentation, and retry mechanisms to prevent a single blocked operation from stalling the entire interaction.
At the infrastructure level, general services such as object storage, logging, monitoring, and alerting from Baidu AI Cloud can be used to build a storage, audit, and operations loop. Specific choices should be evaluated against the team’s existing technology stack, data compliance requirements, and cost budget.
4. Development Workflow: From Requirements to Production
Step 1: Break Down the Requirements
Determine whether the application is primarily a knowledge assistant, document analysis tool, real-time information service, or voice assistant. Then distinguish between required and optional capabilities.
Step 2: Select Capabilities
Enable expensive capabilities only for high-frequency or high-value scenarios. For lower-frequency use cases, use explicit user-triggered activation instead of enabling everything by default.
Step 3: Design Session and Data Models
Define structures for messages, attachments, citations, user feedback, and import records. A stable data model is especially important if the application must support history migration or multiple clients.
Step 4: Design Prompts and Orchestration
Organize system instructions, business rules, retrieved evidence, and user input into separate layers. This makes the workflow easier to control, evaluate, and update.
Step 5: Establish Evaluation
Create offline and online metrics covering accuracy, citation completeness, latency, refusal rate, and safety. Evaluation should include representative tasks and regression tests rather than relying only on subjective impressions.
Step 6: Release Gradually and Monitor
Use staged rollout and observe quality and cost by tenant, scenario, and application version. Monitoring should cover both user-facing outcomes and the underlying capability calls.
5. Reference Implementations and Conversation History Migration
The greatest value of a sample application or open-source reference implementation is that it demonstrates a runnable end-to-end workflow. This may include how the frontend displays streaming output, how the backend manages sessions, how files are parsed and indexed, how webpage content is extracted, and how historical conversations are imported.
Conversation history import is particularly important because it reduces migration costs for users. It also forces developers to design a stable session data structure.
During import, the application should validate fields, remove duplicates, sort records chronologically, and filter sensitive information. Untrusted historical content should never be inserted directly as a system instruction.
6. Engineering Challenges and Governance
Open capabilities do not automatically produce a usable application. Common challenges include:
- Context-window limits and long-document chunking
- Retrieval quality and recall
- Noise in extracted webpage content
- File-parsing errors
- Voice interaction latency
- Concurrency limits and rate control
- Uncontrolled costs
- Prompt injection
- Content safety
Governance should include least-privilege permissions, tenant isolation, log redaction, traceable citations, and auditable outputs. Each capability should have its own timeout and fallback strategy.
For high-risk scenarios, retain a human review process and a channel for appeals or corrections.
7. Use Cases and Best Practices
Typical use cases include personal knowledge assistants, vertical customer service, contract and report analysis, real-time information summarization, voice question answering, and industry-specific workflow assistants.
Recommended practices include:
- Start with a narrow, closed-loop scenario before expanding the capability set.
- Structure retrieval and parsing results instead of passing them as unprocessed text.
- Include sources with answers whenever possible.
- Provide explicit controls for high-cost capabilities.
- Build evaluation datasets and regression tests.
- Include call traces, cost, and quality metrics in routine operations.
With these practices, developers can turn callable capabilities into an operable product. This makes it possible to capture the value of AI applications while maintaining control over cost, reliability, security, and risk.
