DeepSeek API Integration for Python

Connect Python applications to DeepSeek’s Responses API with the adapter’s typed chat, streaming, and reasoning interfaces.

All providers

Installation

Use Python 3.10–3.14 and run this command in your virtual environment.

python -m pip install llm-api-adapter==0.11.0 llm-api-adapter-deepseek==0.1.2

Authentication

Open DeepSeek API setup. Follow the API key link to the DeepSeek Platform and create a key for your application. Set the following in the terminal where you will run the example.

export DEEPSEEK_API_KEY="your-api-key"

Quickstart

Send a message

Save the example as chat.py and run python chat.py.

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 what an API is in one sentence.")],
    max_tokens=1024,
    timeout_s=60,
)
print(response.content)

Supported models

Registry snapshot

Prices are first-tier base rates from the adapter registry. Open a model for all tiers, cache rates, pricing schedules, and capability notes. Unknown means the registry has no value.

  • deepseek-flash

    Context tokens
    1,000,000
    Base input per million tokens
    0.15 USD
    Maximum output tokens
    384,000
    Base output per million tokens
    0.6 USD
    Reasoning
    Supported
    Image URLs
    Unknown
    PDF URLs
    Unsupported
    PDF bytes
    Supported
    JSON Schema output
    Unknown
    Pydantic output
    Unknown

Provider-specific features and limitations

  • Send the full conversation with each request. The adapter does not continue the conversation by provider response ID.
  • Named function-tool selection and tool-result continuation disable thinking for that request. Use reasoning_level to select the thinking effort on other requests.

Resources