llm-api-adapter-deepseek
Official direct DeepSeek API support for llm-api-adapter.
This independently versioned package targets Core >=0.9.6,<1.0.0 and adds no
DeepSeek SDK dependency. Select it through the existing
UniversalLLMAPIAdapter facade with organization deepseek and the canonical
model deepseek-flash.
Installation
pip install "llm-api-adapter[deepseek]"
Direct installation is also supported when Core is managed separately:
pip install llm-api-adapter-deepseek
The Core extra and the direct package install provide the same organization plugin. The extra is the recommended route when installing Core and its optional organization support together; direct installation is useful when Core is already installed or managed by a separate dependency set.
Core discovery behavior
Core recognizes deepseek as an optional organization without importing this
package in its base installation. Selecting deepseek before installing the
package raises an actionable error:
Organization 'deepseek' is not installed. Install it with: pip install llm-api-adapter-deepseek
After either installation route, the entry point is loaded lazily when the
facade selects organization="deepseek". An unknown name such as
organization="deepseek-like" is not treated as an uninstalled DeepSeek
package and instead raises the distinct unsupported-organization error.
Quick start
import os
from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter
adapter = UniversalLLMAPIAdapter(
organization="deepseek",
model="deepseek-flash",
api_key=os.environ["DEEPSEEK_API_KEY"],
)
response = adapter.chat(
messages=[UserMessage("Explain retrieval-augmented generation.")],
max_tokens=256,
)
print(response.content)
Supported model and compatibility
The package exposes one exact, verified model ID: deepseek-flash. It uses the
official Responses API and keeps the public Core request shape unchanged.
| Capability | deepseek-flash |
|---|---|
Text chat() / achat() |
Supported |
| Sync and async streaming | Supported |
| Application function tools | Supported; named tool selection and tool-result continuation force reasoning_level="none" and emit a warning because DeepSeek thinking rejects that function-tool combination. Provider-built-in tools are rejected. |
| Portable JSON Schema and Pydantic output | Supported |
| Reasoning | Supported levels: none, low, high, max; visible reasoning is opt-in |
| Images | User-message URL, bytes, and base64 data URI; JPEG, PNG, GIF, and WebP only |
| Documents and generic files | Unsupported; rejected before transport |
| OCR, Files API upload, local conversion, and document fallback | Not implemented |
The adapter rejects unsupported capabilities before either the synchronous or asynchronous client is invoked. It does not infer support from model prefixes, retired aliases, or an endpoint name.
Images and the file boundary
ImagePart may be supplied only on a UserMessage. DeepSeek accepts an
HTTP(S) image URL, image bytes with an explicit supported MIME type, or a
base64 data URI. The adapter validates the documented boundary locally:
- supported media types are
image/jpeg,image/png,image/gif, andimage/webp; - external image URLs are limited to 8,192 characters;
- inline image data is limited to 32 MiB per image; and
- a request may contain at most 600 images.
Every DocumentPart, generic FilePart, non-user image, unsupported image
form, OCR/upload/conversion route, and other non-image file input raises a
compatibility error before an outbound request. The package never fetches
document URLs, uploads files, runs OCR, converts documents, or silently falls
back to another endpoint or model.
History and continuation privacy
DeepSeek Responses requests are stateless. Keep the complete conversation in
the normal messages list, including assistant tool calls and ToolMessage
results. previous_response does not send a provider
previous_response_id; it is used only to carry the matching opaque reasoning
replay material required by a subsequent DeepSeek request.
That replay material is kept in ChatResponse.provider_data, never merged into
visible assistant text or reasoning_events, never included in repr or
public serialization, and never logged. Set capture_reasoning=True only when
the caller explicitly wants provider reasoning summaries exposed through the
normal reasoning callbacks.
Usage and standard-rate estimates
DeepSeek reports normalized input_tokens, output_tokens, and
total_tokens, plus optional usage.input_tokens_details.cached_tokens and
usage.output_tokens_details.reasoning_tokens. The package retains those
details when they are valid and calculates a USD standard-rate estimate from
the UTC request-dispatch window:
| Window | Cache-hit input / 1M | Cache-miss input / 1M | Output / 1M |
|---|---|---|---|
| Peak (weekdays 01:00–04:00 and 06:00–10:00 UTC) | $0.006 | $0.30 | $1.20 |
| Off-peak (all other times) | $0.003 | $0.15 | $0.60 |
These values are a standard estimate, not an invoice. Context caching is managed by DeepSeek; the SDK does not store or control a cache. If usage, cached-token details, the dispatch timestamp, or the selected rate cannot be verified, the relevant cost field remains unavailable rather than being guessed. See the DeepSeek pricing and Responses usage documentation for provider semantics.
Official DeepSeek references
Metadata
Release files for llm-api-adapter-deepseek 0.1.0
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 | Actions |
|---|---|---|---|---|
| llm_api_adapter_deepseek-0.1.0.tar.gz | 30.0 kB | Without provenance | Details for llm_api_adapter_deepseek-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_api_adapter_deepseek-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llm_api_adapter_deepseek-0.1.0-py3-none-any.whl |
Total release size: 55.2 kB
Release files / llm_api_adapter_deepseek-0.1.0.tar.gz
| Download URL | llm_api_adapter_deepseek-0.1.0.tar.gz |
|---|---|
| Size | 30.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66c553a129f79f555e3dd2a75d98f89ee55eeb136595526d11e2b82b2a1105e3
|
|
BLAKE2b-256 checksum How to use checksums |
15ba9e0a3826a35705d60281b2313465635f764700f6d8347ff131287b6abdb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / llm_api_adapter_deepseek-0.1.0-py3-none-any.whl
| Download URL | llm_api_adapter_deepseek-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a81f67a3d4766f2af95a04cbe2893089350d666643f6e5a5bae8696eb7efb8d
|
|
BLAKE2b-256 checksum How to use checksums |
d34b95b2fe13df8039f1f20720704deb416c24c9cedd6ad84f34d5065a0c8d45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for llm-api-adapter-deepseek 0.1.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.