Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

15 Commits

Repository files navigation

deepseek_api

Python client library for unofficial DeepSeek Web API with automatic PoW challenge solving, automatic model mapping, and built-in auto-healing retries.

Installation

pip install deepseek-api
# or with uv
uv add deepseek-api

Quick Start

fromdeepseek_apiimportDeepSeek, login# Initialize client with authorization tokenclient=DeepSeek(auth_token="Bearer eyJhbGciOi...")
# Create a conversation sessionsession=client.new_session()
# Send a chat message (supports automatic model mapping for 'deepseek-v3', 'deepseek-r1')response=session.send_message("Hello, how are you?", model="deepseek-v3")
print("Response:", response["content"]["response"])
# Stream a response in real-timeforevent_type, chunkinsession.send_message_stream("Explain quantum physics simply", model="deepseek-r1"):
ifevent_typein ("content", "thought"):
print(chunk, end="", flush=True)

Features

  • Single Authorization Token: Only requires auth_token (no Cookie header needed).
  • Auto Model Mapping: Automatically resolves parameters (thinking_enabled, model_type) for models such as deepseek-v3 and deepseek-r1.
  • Built-in Auto-Healing Retries: Retries up to 3 times automatically on transient 40300 errors, network timeouts, or expired chat rooms.
  • WASM PoW Solver: Solves DeepSeek proof-of-work challenges natively using curl_cffi and WASM execution.
  • Stateful Conversation: Manages chat_session_id and parent_message_id across turns.

License

MIT

About

Provides an unofficial API for DeepSeek by reverse-engineering its web interface.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages