deepseek-recipe/deepseek-recipe-python
icrim 57b9c84242 Initial commit
Co-authored-by: xinchengxx <xinchengxx@deepseek.com>
Co-authored-by: XieJiSS <xiejiss@deepseek.com>
Co-authored-by: yqaty <jiayu@deepseek.com>
Co-authored-by: zhu-he <hezhu@deepseek.com>
Co-authored-by: season-guo <seasonguo@deepseek.com>
2026-09-10 18:07:01 +08:00
..
python/deepseek_recipe Initial commit 2026-09-10 18:07:01 +08:00
src Initial commit 2026-09-10 18:07:01 +08:00
tests Initial commit 2026-09-10 18:07:01 +08:00
build.rs Initial commit 2026-09-10 18:07:01 +08:00
Cargo.toml Initial commit 2026-09-10 18:07:01 +08:00
LICENSE Initial commit 2026-09-10 18:07:01 +08:00
pyproject.toml Initial commit 2026-09-10 18:07:01 +08:00
README.md Initial commit 2026-09-10 18:07:01 +08:00
THIRD_PARTY_LICENSES Initial commit 2026-09-10 18:07:01 +08:00

deepseek-recipe-python

Python bindings for deepseek-recipe: conversion of Messages, Chat Completions, and Responses requests, DeepSeek V4/V4.1 prompt and token encoding, image preprocessing, and response streaming. Model inference, tool execution, and HTTP transport are provided by the application.

Installation

Python 3.10 or later:

python3 -m pip install deepseek-recipe

Import as deepseek_recipe. Source builds require Rust, OpenCV 4.x, and Clang/libclang.

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)

License

MIT. The distribution includes the license text.