Skip to content￼Navigation Menu￼￼xtekky/deepseek4free￼Type / to search￼￼￼￼￼￼￼￼￼￼￼￼￼￼CodeIssues5Pull requests1ActionsProjectsSecurityInsightsYou only have a single verified email address. We recommend verifying at least one more email address to ensure you can recover your account if you lose access to your primary email.Email settings￼￼￼￼deepseek4freePublic￼Fork 32￼ Star 114￼￼xtekky/deepseek4free￼ main1 Branch0 Tags￼Add fileAdd fileCodeFolders and filesNameLast commit messageLast commit dateLatest commit￼xtekkyMerge pull request #9 from theguy000/main￼4ae47bb · 3 weeks agoHistory20 CommitsdskDelete dsk/cookies.json3 weeks ago.gitattributesInitial commit2 months ago.gitignoreUpdate gitignore and cleanup files3 weeks agoLICENSEInitial commit2 months agoREADME.mdsimple way of getting token3 weeks agoexample.pyadd cookie management and Cloudflare bypass functionalityadd cookie management and Cloudflare bypass functiona…3 weeks agorequirements.txtcloudfare bypass3 weeks agoRepository files navigationREADMEMIT license￼￼DeepSeek4Free￼A Python package for interacting with the DeepSeek AI chat API. This package provides a clean interface to interact with DeepSeek's chat model, with support for streaming responses, thinking process visibility, and web search capabilities.Learn how to reverse engineer private api's !!￼• and reverse wasm like it was required here• whop.com/reverser-academy (beta)⚠️Service Notice: DeepSeek API is currently experiencing high load. Work is in progress to integrate additional API providers. Please expect intermittent errors.📝 Note: If you encounter any errors, please ensure you are using the latest version of this library. The DeepSeek API may change frequently, and updates are released to maintain compatibility.✨ Features￼• 🔄 Streaming Responses: Real-time interaction with token-by-token output• 🤔 Thinking Process: Optional visibility into the model's reasoning steps• 🔍 Web Search: Optional integration for up-to-date information• 💬 Session Management: Persistent chat sessions with conversation history• ⚡ Efficient PoW: WebAssembly-based proof of work implementation• 🛡️ Error Handling: Comprehensive error handling with specific exceptions• ⏱️ No Timeouts: Designed for long-running conversations without timeouts• 🧵 Thread Support: Parent message tracking for threaded conversations📦 Installation￼1. Clone the repository:git clone https://github.com/yourusername/deepseek4free.git
cd deepseek4free￼2. Install dependencies:pip install -r requirements.txt￼🔑 Authentication￼To use this package, you need a DeepSeek auth token. Here's how to obtain it:If you know how to use chrome devtools, simply run this snipped in the console:JSON.parse(localStorage.getItem("userToken")).value￼Method 1: From LocalStorage (Recommended)￼￼1. Visit chat.deepseek.com2. Log in to your account3. Open browser developer tools (F12 or right-click > Inspect)4. Go to Application tab (if not visible, click >> to see more tabs)5. In the left sidebar, expand "Local Storage"6. Click on "https://chat.deepseek.com"7. Find the key named userToken8. Copy "value" - this is your authentication tokenMethod 2: From Network Tab￼Alternatively, you can get the token from network requests:1. Visit chat.deepseek.com2. Log in to your account3. Open browser developer tools (F12)4. Go to Network tab5. Make any request in the chat6. Find the request headers7. Copy the authorization token (without 'Bearer ' prefix)Handling Cloudflare Challenges￼If you encounter Cloudflare challenges ("Just a moment..." page), you'll need to get a cf_clearance cookie. Run this command:python -m dsk.bypass￼This will:1. Open an undetected browser2. Visit DeepSeek and solve the Cloudflare challenge3. Capture and save the cf_clearance cookie4. The cookie will be automatically used in future requestsYou only need to run this when:• You get Cloudflare challenges in your requests• Your existing cf_clearance cookie expires• You see the error "Please wait a few minutes before trying again"The captured cookie will be stored in dsk/cookies.json and automatically used by the API.📚 Usage￼Basic Example￼from dsk.api import DeepSeekAPI

# Initialize with your auth token
api = DeepSeekAPI("YOUR_AUTH_TOKEN")

# Create a new chat session
chat_id = api.create_chat_session()

# Simple chat completion
prompt = "What is Python?"
for chunk in api.chat_completion(chat_id, prompt):
    if chunk['type'] == 'text':
        print(chunk['content'], end='', flush=True)￼Advanced Features￼Thinking Process Visibility￼The thinking process shows the model's reasoning steps:# With thinking process enabled
for chunk in api.chat_completion(
    chat_id,
    "Explain quantum computing",
    thinking_enabled=True
):
    if chunk['type'] == 'thinking':
        print(f"🤔 Thinking: {chunk['content']}")
    elif chunk['type'] == 'text':
        print(chunk['content'], end='', flush=True)￼Web Search Integration￼Enable web search for up-to-date information:# With web search enabled
for chunk in api.chat_completion(
    chat_id,
    "What are the latest developments in AI?",
    thinking_enabled=True,
    search_enabled=True
):
    if chunk['type'] == 'thinking':
        print(f"🔍 Searching: {chunk['content']}")
    elif chunk['type'] == 'text':
        print(chunk['content'], end='', flush=True)￼Threaded Conversations￼Create threaded conversations by tracking parent messages:# Start a conversation
chat_id = api.create_chat_session()

# Send initial message
parent_id = None
for chunk in api.chat_completion(chat_id, "Tell me about neural networks"):
    if chunk['type'] == 'text':
        print(chunk['content'], end='', flush=True)
    elif 'message_id' in chunk:
        parent_id = chunk['message_id']

# Send follow-up question in the thread
for chunk in api.chat_completion(
    chat_id,
    "How do they compare to other ML models?",
    parent_message_id=parent_id
):
    if chunk['type'] == 'text':
        print(chunk['content'], end='', flush=True)￼Error Handling￼The package provides specific exceptions for different error scenarios:from dsk.api import (
    DeepSeekAPI, 
    AuthenticationError,
    RateLimitError,
    NetworkError,
    CloudflareError,
    APIError
)

try:
    api = DeepSeekAPI("YOUR_AUTH_TOKEN")
    chat_id = api.create_chat_session()
    
    for chunk in api.chat_completion(chat_id, "Your prompt here"):
        if chunk['type'] == 'text':
            print(chunk['content'], end='', flush=True)
            
except AuthenticationError:
    print("Authentication failed. Please check your token.")
except RateLimitError:
    print("Rate limit exceeded. Please wait before making more requests.")
except CloudflareError as e:
    print(f"Cloudflare protection encountered: {str(e)}")
except NetworkError:
    print("Network error occurred. Check your internet connection.")
except APIError as e:
    print(f"API error occurred: {str(e)}")￼AboutDeepseek V3 and R1 private API, deep thinking, search, full requests. pow challenge reversed. deepseek api.whop.com/reverser-academy/Topicsdeepseekdeepseek-apideepseek-v3deepseek-r1Resources ReadmeLicense MIT licenseActivityStars114 starsWatchers4 watchingForks32 forksReport repositoryReleasesNo releases publishedPackagesNo packages published
Contributors2￼xtekky Tekky￼theguy000 TheGuyLanguagesPython100.0%Footer￼© 2025 GitHub, Inc.Footer navigationTermsPrivacySecurityStatusDocsContactManage cookiesDo not share my personal information￼xtekky/deepseek4free: Deepseek V3 and R1 private API, deep thinking, search, full requests. pow challenge reversed. deepseek api.￼￼￼￼￼￼￼￼￼Synthesys X is now Phedra X, and it just got smarter. Learn more here.Welcome 👋I'm <PRESIDIO_ANONYMIZED_PERSON>, your intelligent personal designer.reIMAGINE.reDESIGN.￼For the best experience watch the tutorial.￼Video tutorial￼Get startedDisclaimerTerms & ConditionsContactPhedra AI￼￼￼￼￼Sign in￼Sign in￼￼￼Sign in to continue￼￼￼￼￼￼￼