How fly143/deepseek-free-api works
DeepSeek Free API Proxy turns DeepSeek’s web chat service into OpenAI- and Anthropic-compatible APIs. The main workflow accepts a client request, normalizes it, prepares the account/session and upstream request, then relays a response; supporting branches cover model discovery, file and image handling, tool calls, and Responses API lifecycle operations. The README documents these capabilities, while source excerpts and the SOURCE INDEX establish several internal dependencies. Some implementation details are unsampled, so uncertain links are omitted.
Main entry points: proxy.py Chat handling · anthropic_routes.py Messages routes · registrar.py Account registration · tool_call.py Tool prompt building
Components 23
API surface
- API gateway
proxy.py - Messages routes
app/anthropic_routes.py - Messages conversion
app/anthropic.py - Batch API
app/batch.py - Responses API
proxy.py - Admin panel
proxy.py
Conversation pipeline
- Chat handling
proxy.py - Model discovery
proxy.py - File and image handling
proxy.py - Context trimming
context_manager.py - Context compression
context_compressor.py - Tool prompt building
tool_call.py - DSML parsing
tool_dsml.py - Tool output filtering
tool_sieve.py
Accounts and upstream
- Account configuration
app/config.py - Account registration
app/registrar.py - Device ID pool
app/device_ids.py - PoW solver
pow_native.py - DeepSeek API
State and context
- Response storage
response_store.py - Session tracking
session_store.py - Usage tracking
usage_store.py
Other components
- API client
Connections 27
- API client → API gateway: sends requests
README.md - API client → Messages routes: sends messages
README.md - API gateway → Chat handling: dispatches chat
proxy.py - API gateway → Responses API: dispatches responses
README.md - API gateway → Admin panel: serves panel
proxy.py - Messages routes → Messages conversion: converts messages
app/anthropic_routes.py - Messages routes → Chat handling: calls chat
app/anthropic_routes.py - Messages routes → Batch API: uses batch
app/anthropic_routes.py - Chat handling → Model discovery: resolves model
README.md - Chat handling → Context trimming: trims context
proxy.py - Chat handling → Context compression: compresses context
proxy.py - Chat handling → Tool prompt building: builds tool prompt
README.md - Tool prompt building → DSML parsing: parses DSML
tool_call.py - Chat handling → Tool output filtering: filters stream
README.md - Chat handling → File and image handling: uploads files
README.md - Chat handling → Account configuration: loads account
proxy.py - Chat handling → DeepSeek API: forwards HTTPS
README.md - Model discovery → DeepSeek API: probes models
README.md - File and image handling → DeepSeek API: uploads files
README.md - Account configuration → Account registration: configures accounts
app/registrar.py - Account registration → Device ID pool: selects device
app/registrar.py - Account registration → PoW solver: solves challenge
app/registrar.py - Account registration → DeepSeek API: registers account
app/registrar.py - API gateway → PoW solver: solves challenges
README.md - API gateway → Response storage: stores responses
proxy.py - API gateway → Session tracking: tracks sessions
proxy.py - API gateway → Usage tracking: tracks usage
proxy.py