DeepSeek open-sources the plumbing between your API and its models
deepseek-recipe is the Rust glue that turns OpenAI-style requests into DeepSeek prompts and model output back into responses — inference not included.
What it does
It converts requests in Messages, Chat Completions, and Responses formats into a unified Conversation format, renders that into DeepSeek V4/V4.1 prompts, encodes it into token IDs with a bundled tokenizer, and parses model output back into the format the caller asked for. Crucially, it does none of the actual work: model inference, tool execution, and HTTP transport are all the caller’s job. It’s the translation layer, not the engine.
The interesting bit
The boring parts are where the value hides — it handles the fiddly semantics people usually get wrong: default max_tokens resolution against context limits (8192 normally, 65536 in thinking mode, 131072 at max effort), reasoning-token counting via tokenizer re-encoding, and structured output where JSON Schemas are validated and written into the prompt while regexes pass through for the backend to enforce via constrained decoding.
Key highlights
- Rust core with Python bindings (
deepseek_recipeon PyPI), plus an Axum and a FastAPI example server with mock inference. - Streaming support, thinking mode, tool calls, logprobs plumbing, and image preprocessing for V4.1 (V4 requests get images replaced with
[Unsupported Image]). - Deferred tool loading and client-executed tool search for V4.1.
- A web demo that renders prompts, highlights special tokens, and parses output into any of the three response formats.
- MIT-licensed, split into focused crates (
-core,-encoding,-image,-macros).
Caveats
RequestImageFetcherfetches any URL by default — the README explicitly warns services handling untrusted input to install aDestinationFilter.- It doesn’t compute logprobs or enforce output constraints; it just converts and passes the buck to your backend.
Verdict
If you’re building an inference backend or API gateway for DeepSeek V4/V4.1 models, this saves you weeks of protocol archaeology. If you just want to call an API, you already have that and don’t need this.
Frequently asked
- What is deepseek-ai/deepseek-recipe?
- deepseek-recipe is the Rust glue that turns OpenAI-style requests into DeepSeek prompts and model output back into responses — inference not included.
- Is deepseek-recipe open source?
- Yes — deepseek-ai/deepseek-recipe is open source, released under the MIT license.
- What language is deepseek-recipe written in?
- deepseek-ai/deepseek-recipe is primarily written in Rust.
- How popular is deepseek-recipe?
- deepseek-ai/deepseek-recipe has 1.6k stars on GitHub.
- Where can I find deepseek-recipe?
- deepseek-ai/deepseek-recipe is on GitHub at https://github.com/deepseek-ai/deepseek-recipe.