llm-deepseek
LLM access to DeepSeek's API
Installation
Install this plugin in the same environment as LLM.
llm install llm-deepseek-xtreme
Usage
First, set an API key for DeepSeek:
llm keys set deepseek
# Paste key here
Models (DeepSeek-V3.2)
deepseek-chat: V3.2 non-thinking mode, 128K context, json output + tool calls + chat prefix completiondeepseek-reasoner: V3.2 thinking mode, 128K context, json output + tool calls + chat prefix completion; reasoning always showndeepseek-reasoner-speciale: V3.2-Speciale thinking-only endpoint athttps://api.deepseek.com/v3.2_speciale_expires_on_20251215, up to 128K output, no tools/json/prefix completion (auto-registered)
Chat/reasoner calls use https://api.deepseek.com (Speciale uses its own base automatically). Text completions/FIM automatically use the beta endpoint https://api.deepseek.com/beta.
Pricing (from https://api-docs.deepseek.com/quick_start/pricing): $0.028/M input tokens (cache hit), $0.28/M input tokens (cache miss), $0.42/M output tokens.
Run llm models to list the models, and llm models --options to include a list of their options.
Running Prompts
Run prompts like this:
llm -m deepseek-chat "Describe a futuristic city on Mars"
llm -m deepseek-chat-completion "The AI began to dream, and in its dreams," -o echo true
llm -m deepseek-reasoner "Write a Python function to sort a list of numbers"
Note: The DeepSeek Reasoner model only supports the chat endpoint, not the completion endpoint.
DeepSeek Reasoner Model
The DeepSeek Reasoner model uses a Chain of Thought (CoT) approach to solve complex problems, showing its reasoning process before providing the final answer.
The plugin always shows the model's chain of thought reasoning in non-streaming mode. The reasoning feature is currently only supported in non-streaming mode.
# Normal usage - will show reasoning by default
llm -m deepseek-reasoner "What is 537 * 943?"
New Features
Prefill
The prefill option allows you to provide initial text for the model's response. This is useful for guiding the model's output.
Example:
llm -m deepseek-chat "What are some wild and crazy activities for a holiday party?" -o prefill "Here are some off-the-wall ideas to make your holiday party unforgettable [warning: these may not be suitable for work holiday parties]:"
You can also load prefill text from a file:
# Create a file with your prefill text
echo "Here are some unique holiday party ideas:" > prefill.txt
# Use the file path as the prefill value
llm -m deepseek-chat "What are some fun activities for a holiday party?" -o prefill prefill.txt
This is especially useful for longer prefill text that would be unwieldy on the command line.
JSON Response Format
The response_format option allows you to specify that the model should output its response in JSON format. To ensure the model outputs valid JSON, include the word "json" in the system or user prompt. Optionally, you can provide an example of the desired JSON format to guide the model.
Example:
llm -m deepseek-chat "What are some fun activities for a holiday party?" -o response_format json_object --system "json"
To guide the model further, you can provide an example JSON structure:
llm -m deepseek-chat "What are some way to tell if a holiday party is fun?" -o response_format json_object --system 'EXAMPLE JSON OUTPUT: {"event": "holiday_party_fun", "success_metric": ["..."]}'
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-deepseek
python3 -m venv venv
source venv/bin/activate
Publish to PyPI after bumping the version:
pip install -e '.[test]' build twine
python -m build
twine upload dist/*
Metadata
Release files for llm-deepseek-xtreme 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| llm_deepseek_xtreme-0.2.2.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_deepseek_xtreme-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.5 kB
Release files / llm_deepseek_xtreme-0.2.2.tar.gz
| Download URL | llm_deepseek_xtreme-0.2.2.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55d87eed6d370fec30c1312626c9738d5e12bd5ef59bd6758e2952c992c2f68c
|
|
BLAKE2b-256 checksum How to use checksums |
5d0ac71b6a37903dcadc1226a67a77f05b5ec532c16ea31819f0898a0f29ad5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / llm_deepseek_xtreme-0.2.2-py3-none-any.whl
| Download URL | llm_deepseek_xtreme-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f593b5eaee222707f343380751bb08722b1c145d1eb95a292b80df546cf85ed5
|
|
BLAKE2b-256 checksum How to use checksums |
4d15ba25a099ebea80eb8209d5a813e1f93d1aa542aae3c6ab865390d326f513
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for llm-deepseek-xtreme 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.