Skip to main content

llm-api-adapter-deepseek

An optional DeepSeek organization package for LLM API Adapter, a Python SDK with one shared interface for calling LLM APIs.

Uses the official DeepSeek Responses API directly.

The package 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 models

  • deepseek-flash

Capabilities

The package uses the official Responses API with the shared Core request shape.

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.

Named tool selection is a pass exception: disabling reasoning adapts the provider restriction while preserving the tool-call contract. Exact request behavior, limits, and exceptions are recorded in the DeepSeek registry.

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, and image/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. Confirmed cache reads become Usage.cached_tokens, a subset of total input. There is no separately priced automatic write component; cache_write_tokens remains None.

The USD estimate uses pricing_tiers and the UTC pricing_schedule in the registry. The request-dispatch window selects the multiplier for ordinary input, cached input, and output rates; ordinary input excludes the reported cache-read subset. No rates or time windows are inferred from model names.

An omitted cache split leaves cost_input and cost_total unknown while known output cost can remain available. Missing or invalid pricing context prevents the estimate; no locally guessed counts or rates are substituted. Caching is provider-managed, and opt-in controls, selectable TTLs, and storage pricing are excluded. These are standard-rate estimates, not an invoice. See the shared usage and pricing guide, DeepSeek pricing and Responses usage documentation for provider semantics.

Official DeepSeek references

Metadata

Release files for llm-api-adapter-deepseek 0.1.1

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-api-adapter-deepseek 0.1.1
File Size Uploaded Provenance Actions
llm_api_adapter_deepseek-0.1.1.tar.gz 31.7 kB Without provenance Details for llm_api_adapter_deepseek-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-api-adapter-deepseek 0.1.1
File Interpreter ABI Platform Actions
llm_api_adapter_deepseek-0.1.1-py3-none-any.whl Python 3 none any Details for llm_api_adapter_deepseek-0.1.1-py3-none-any.whl

Total release size: 56.8 kB

Release files / llm_api_adapter_deepseek-0.1.1.tar.gz

Download URL llm_api_adapter_deepseek-0.1.1.tar.gz
Size 31.7 kB
Tags Source
SHA-256 checksum
How to use checksums
392364fc72f3f2d5853e3f92b5caa1635b2a71f293b49e80f434fe0c9fe75991
BLAKE2b-256 checksum
How to use checksums
6d668a2650b30b55540e8480647a95fc60b4fd09503e7c4fa99dc41eac972a70
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.1-py3-none-any.whl

Download URL llm_api_adapter_deepseek-0.1.1-py3-none-any.whl
Size 25.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f3ed0ad90786e97637291f2e32930985f77b9a5c78ead32fcd26586e329d9b7
BLAKE2b-256 checksum
How to use checksums
f156ac8c4dae5de147899e7a4c343a6618738d4702c0346cffb96f2ad66028c2
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.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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