跪拜 Guibai
← All articles
DeepSeek · Agent · Artificial Intelligence

DeepSeek Puts Its Whole App Stack Behind One API and Open-Sources the Web Client

By 沉默王二 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

One vendor now supplies the search, fetch, OCR, file-understanding, and speech stack that previously forced agent and RAG builders to juggle Alibaba Cloud, Zhipu, and Volcano Engine accounts, SDKs, and auth paths. DeepSeek's open-sourced chat-demo hands over working reference code for the tricky parts: signed link contexts, in-browser WAV assembly, and streaming PCM playback.

Summary

DeepSeek's family-bucket API release converts the full feature set of its consumer App and web client into server-side capabilities. Three protocols are supported: Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions. Built-in tools handle web search, deep-thinking search, link reading, file upload, and content safety, while separate REST endpoints expose search, fetch, OCR, ASR, and TTS for direct use in agent pipelines.

An integration write-up from a RAG knowledge base project documents the practical edges. Built-in and custom tools cannot share one request, so a project with its own retrieval walks around the built-in web search and calls the standalone search and fetch endpoints instead. The Files API bills by page count but returns no page count, forcing local preprocessing with PDFBox and headless LibreOffice to block encrypted files and estimate token cost. The built-in link-reader returns page content encrypted in a signature field that the frontend must echo back next turn, and streaming TTS needs odd-byte alignment buffering to avoid noise. The swap also replaced Alibaba Cloud OCR, which had burned through 500+ yuan in a week.

Takeaways
— DeepSeek's APIs speak three protocols: Anthropic Messages, OpenAI Responses, and OpenAI Chat Completions.
— Server-side tools include deepseek_web_search (also usable in deep-thinking mode), deepseek_read_url, file input, and content safety vetting that refuses risky output.
— Standalone endpoints: search (with per-result relevance and authority scores), fetch (returns Markdown), OCR (returns text plus position coordinates), ASR (21 languages), and streaming TTS with male and female voices.
— File upload's purpose field selects parsing: user_data (free, for text/code/tables), text_recognition (text only from PDF/Word/PPT/images), rich_layout_recognition (text plus charts).
— The purpose field must appear before the file field in an upload request, or the API errors.
— The Files API bills by page count but the response carries only file ID and byte count, so clients must compute page counts locally and block encrypted PDFs beforehand.
— Files parse synchronously inside the upload request; a dropped connection still completes parsing and billing.
— Built-in tools and user-defined tools cannot be combined in one request, which pushes projects with custom retrieval toward the standalone search and fetch endpoints.
— The built-in link-reading tool returns encrypted page content in a signature field, and the frontend must echo the signature back in the next turn for the server to restore the content.
— ASR rejects browser MediaRecorder WebM output; clients must capture 16-bit PCM WAV at 16000 Hz, which chat-demo does via Web Audio API plus a 44-byte WAV header.
— Streaming TTS emits 24000 Hz 16-bit PCM; odd-length network chunks must be buffered and realigned or playback produces noise.
— DeepSeek open-sourced chat-demo, a web client that reproduces the official product once an API key is supplied.
Conclusions

The signature-based read-link protocol keeps fetched page content off the client side entirely, but any custom client must reproduce the exact signature-echo behavior or lose web context across turns.

Charging by page count while omitting page count from the response is a billing blind spot that forces every serious integration to pay for its own page-counting pipeline.

The ban on mixing built-in and custom tools in one request pushes agent builders toward the standalone endpoints, which lose the tight deep-thinking integration the built-in tool provides.

Consolidating search, OCR, and TTS under one vendor removes multi-platform account and SDK overhead, but it concentrates availability and pricing risk in DeepSeek.

Concepts & terms
RAG knowledge base
An architecture in which a model answers questions by retrieving and reading relevant chunks from a knowledge base built from user documents, rather than relying only on its pretrained knowledge.
Signature-based link context
DeepSeek's built-in read-link tool returns fetched page content encrypted inside a signature field instead of plain text; clients pass the signature back in later turns so the server can decrypt and restore the content server-side.
purpose parsing modes
The purpose field on DeepSeek's file upload selects how a document is parsed: user_data for plain text and code, text_recognition for extracting text only, rich_layout_recognition for passing both text and charts to the model.
Byte alignment in streaming PCM
A 16-bit PCM audio sample occupies 2 bytes; when network chunks end on an odd byte, the following data shifts out of alignment and causes static. Buffering the leftover byte and prepending it to the next chunk keeps playback clean.
From the discussion

The two comments converge on the practical benefits of a unified API while flagging a critical cost-accounting pitfall. The first comment argues that before choosing providers, the industry must reconcile token counting, cache billing, and retry charges, otherwise any cost comparison is meaningless; it advocates one gateway with a single key. The second comment values the convenience of a single API for small tools and specifically appreciates the OCR coordinate output for document parsing.

— Cost calculations based on provider selection are invalid unless token counting, cache-hit billing, and retry charges are aligned across vendors; discrepancies reach 20-30% on the same prompt.
— A single gateway with one key and per-business-line export reconciles usage with upstream bills at month-end.
— Unified access to OCR, search, and speech endpoints eliminates the need to integrate several vendors for small utilities.
— OCR's coordinate-bearing output reduces pitfalls in document parsing.
Featured comments
用户573468752399

After DeepSeek opens up the whole family bucket, everyone's first reaction is to grab a few more models, but the real trouble on the integration side is the metrics: the same prompt, different providers' token counts can differ by 20-30%; cache hits are sometimes listed separately, sometimes counted into input; 429 retries still get billed by the upstream. If these aren't aligned first, the costs calculated from selection are all wrong. Our approach is one gateway, one Key to call all domestic providers, with details exported by business line, and it reconciles at month-end. Details via private message.

用户55568270537

This wave is indeed practical. Previously OCR, search, speech had to integrate several providers, now one API can string them together, which saves a lot of effort for small tools. The detail that OCR returns coordinates is quite useful, and can avoid many pitfalls in document parsing.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗