@tianyi: DeepSeek has open-sourced some new code repositories, making it easier to deploy V4.1 Flash as well as subsequent open-…

X AI KOLs Following Tools

Summary

DeepSeek has open-sourced new code repositories, including libraries and tools, to facilitate the deployment of V4.1 Flash and subsequent open-source models.

DeepSeek has open-sourced some new code repositories, making it easier to deploy V4.1 Flash as well as subsequent open-source models: https://github.com/deepseek-ai/deepseek-recipe… https://github.com/deepseek-ai/DeepSelect… https://github.com/deepseek-ai/DeepJIT…
Original Article
View Cached Full Text

Cached at: 09/12/26, 09:01 PM

DeepSeek has open-sourced some new code repositories, making it easier to deploy V4.1 Flash as well as subsequent open-source models: https://github.com/deepseek-ai/deepseek-recipe… https://github.com/deepseek-ai/DeepSelect… https://github.com/deepseek-ai/DeepJIT…


deepseek-ai/deepseek-recipe

Source: https://github.com/deepseek-ai/deepseek-recipe

DeepSeek

deepseek-recipe

English | 中文

deepseek-recipe is a collection of Rust libraries and Python bindings that uniformly convert API requests in different formats into the Conversation format, encode them into prompts for DeepSeek models, and convert model output into responses in the corresponding format. Use these components to connect an inference backend to API services that support multiple formats. Model inference, tool execution, and HTTP transport must be provided externally.

Getting started · Streaming response · Use with tokenizer · License

Supported scope

  • Request/response formats: Conversion of Messages, Chat Completions, and Responses requests, Streaming response, and complete responses. Supports text, images, thinking, and client tool calls.
  • Prompts: Encoding of DeepSeek V4 and V4.1 conversations into prompts or token IDs.
  • Generation settings: Thinking mode, reasoning effort, temperature, top_p, and output token limits.
  • Output parsing: Thinking, tool calls, JSON object output, and stop sequences.
  • Images: Provided as base64 or external URLs. The image component provides DeepSeek V4.1 preprocessing with OpenCV.
  • Tool definitions: Function tools; the Responses API also supports tool namespaces and the apply_patch custom tool.

Not yet supported

  • Token probabilities (logprobs and top_logprobs).
  • Document content, audio/video input, and file retrieval by file_id.
  • Server tool execution, such as web_search.
  • JSON Schema and regex output constraints, or enforcement of tool strict settings.
  • Multiple completions per Chat Completions request (n > 1).
  • Responses custom tool definitions other than apply_patch.
  • Responses conversation storage and context retrieval through previous_response_id.
  • Responses encrypted thinking content (encrypted_content).

Using deepseek-recipe

To convert a Chat Completions request into a DeepSeek V4.1 prompt:

Python

Installation

Python 3.10+:

python3 -m pip install deepseek-recipe

Example

from deepseek_recipe import ChatCompletionRequest, ConversionOptions, DeepseekV41Encoding

request = ChatCompletionRequest({
    "model": "deepseek-flash",
    "messages": [{"role": "user", "content": "Hello"}],
})
converted = request.convert(ConversionOptions())
rendered = DeepseekV41Encoding().render_conversation(converted.conversation)
print(rendered.prompt)

Rust

Installation

cargo add [email protected] [email protected]

See the development guide for source builds and image dependencies.

Example

use deepseek_recipe::openai::ChatCompletionRequest;
use deepseek_recipe::request::{ConversionOptions, ProtocolRequest};
use deepseek_recipe_encoding::PromptEncoding;
use deepseek_recipe_encoding::v4::dsv41::DeepseekV41Encoding;
use serde_json::json;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let request: ChatCompletionRequest = serde_json::from_value(json!({
        "model": "deepseek-flash",
        "messages": [{"role": "user", "content": "Hello"}],
    }))?;
    let converted = request.convert(ConversionOptions::default())?;
    let rendered = DeepseekV41Encoding::new().render_conversation(&converted.conversation);
    println!("{}", rendered.prompt);
    Ok(())
}

Encoding & Decoding Demo

Run the encoding and decoding demo from the repository root:

cargo run -p encoding-decoding-demo --locked

Open http://127.0.0.1:7778.

More examples

Rust and Python both support converting model output into streaming responses. See the Streaming response. To encode conversations into token IDs or decode backend token IDs, see use with tokenizer.

Packages and example projects

PackagePurpose
deepseek-recipeProtocol conversion and model output parsing.
deepseek-recipe-coreShared conversation, message, image, and tool types.
deepseek-recipe-encodingDeepSeek V4 and V4.1 prompt rendering and token encoding.
deepseek-recipe-imageImage fetching and preprocessing.
deepseek-recipe-pythonPython bindings, imported as deepseek_recipe.
encoding-decoding-demoA web interface for encoding prompts, inspecting special tokens, and decoding complete model output into Chat Completions, Responses, or Messages.
server-rsAn Axum API example with mock inference.
server-pyA FastAPI example with mock inference.

License

Project code and public documentation are licensed under the MIT License. Bundled tokenizer notices are in static/tokenizers/README.md.

Similar Articles

DeepSeek v4.1 Flash

Hacker News Top

DeepSeek has introduced DeepSeek-V4.1-Flash, a new AI model designed for enhanced capability, faster inference, native visual understanding, and scalability as part of their latest architecture family.

deepseek-ai/DeepSeek-V4.1-Flash · Hugging Face

Reddit r/LocalLLaMA

The repository provides prompt encoding and a minimal PyTorch inference implementation for the DeepSeek-V4.1-Flash AI model, including components like vision encoder, MoE, and Hyper-Connections under an MIT License.

DeepSeek V4 Flash Vision is now live !

Reddit r/ArtificialInteligence

DeepSeek has released vision capabilities for its V4 Flash AI model, providing a cheaper inference option through DeepInfra compared to the official API.

deepseek-ai/DeepSeek-V4-Flash

Hugging Face Models Trending

DeepSeek releases DeepSeek-V4-Flash and DeepSeek-V4-Pro, new MoE language models supporting 1 million token contexts with improved efficiency and performance.