Skip to main content

llm-deepseek-ya

PyPI License

LLM access to DeepSeek's API

Installation

Install this plugin in the same environment as LLM.

llm install llm-deepseek-ya

Usage

First, set an API key for DeepSeek:

llm keys set deepseek
# Paste key here

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-flash "Describe a futuristic city on Mars"
llm -m deepseek-v4-pro "Write a Python function to sort a list of numbers"

The legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are aliases for deepseek-flash.

Thinking Mode

Both models think by default and the plugin shows the chain of thought reasoning before the final answer.

# Normal usage - will show reasoning by default
llm -m deepseek-flash "What is 537 * 943?"

# Hide reasoning when you only want the final answer
llm -m deepseek-flash "What is 537 * 943?" -o show_reasoning false

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-flash "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-flash "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-flash "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-flash "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": ["..."]}'

JSON Schema Support

DeepSeek Chat models support JSON schema output (via LLM's --schema option). When you provide a schema, the plugin automatically enables JSON mode and includes the schema in the system message to guide the model's output.

Important Note: DeepSeek's API does not validate the output against the schema - it only uses JSON mode. The schema is provided to the model as guidance, so the model will attempt to follow it, but strict validation is not enforced.

Example:

llm -m deepseek-flash "Generate a user profile" --schema '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "number"}, "email": {"type": "string"}}, "required": ["name", "age"]}'

You can also use LLM's schema file support:

# Create a schema file
cat > user_schema.json << 'EOF'
{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "age": {"type": "number"},
    "email": {"type": "string"},
    "interests": {"type": "array", "items": {"type": "string"}}
  },
  "required": ["name", "age"]
}
EOF

# Use the schema file
llm -m deepseek-flash "Generate a user profile for a software developer" --schema user_schema.json

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-deepseek-ya
python3 -m venv venv
source venv/bin/activate

Metadata

Release files for llm-deepseek-ya 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-deepseek-ya 3.0.0
File Size Uploaded Provenance Actions
llm_deepseek_ya-3.0.0.tar.gz 8.8 kB Without provenance Details for llm_deepseek_ya-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-deepseek-ya 3.0.0
File Interpreter ABI Platform Actions
llm_deepseek_ya-3.0.0-py3-none-any.whl Python 3 none any Details for llm_deepseek_ya-3.0.0-py3-none-any.whl

Total release size: 16.0 kB

Release files / llm_deepseek_ya-3.0.0.tar.gz

Download URL llm_deepseek_ya-3.0.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
796a7054268d3592e7cd4ee8c421afe2e523655961fe2395fed3cbebece4bef6
BLAKE2b-256 checksum
How to use checksums
ab7e22d57f39d4f0a8026999f0ad911adfc9d2a90a40abdf1b50ce045bdd4923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / llm_deepseek_ya-3.0.0-py3-none-any.whl

Download URL llm_deepseek_ya-3.0.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64435c253da88eb9628c0e78a3f2547d5b36e5335623726bd6478294c0d14c07
BLAKE2b-256 checksum
How to use checksums
ef1483d36ea66bfb85d788e582d1511fb1557d43dab2041bae895c49d8b56bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for llm-deepseek-ya 3.0.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page