Skip to content

About

Local DeepSeek API gateway for agent tools using the official API.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DeepSeek Agent Gateway

CI License Python

中文说明 | Security | DeepSeek API docs

DeepSeek Agent Gateway is a local OpenAI-compatible gateway for agent tools that want to use DeepSeek through the official API.

It does not reverse-engineer DeepSeek web login. It does not automate the DeepSeek website. It keeps the real DEEPSEEK_API_KEY on your machine and gives agents a separate local bearer token.

Why This Exists

Many agent tools know how to call an OpenAI-compatible endpoint, but you may not want to paste your real DeepSeek API key into every tool.

This gateway gives you:

  • local-only default binding on 127.0.0.1
  • OpenAI-compatible /v1/chat/completions
  • local bearer token for agent clients
  • DeepSeek API key stays in the gateway process
  • zero runtime dependencies

Install

From source:

git clone https://github.com/xiaokillua/deepseek-agent-gateway.git
cd deepseek-agent-gateway
python3 -m pip install -e .

Quick Start

Create a DeepSeek API key from the official DeepSeek platform, then run:

export DEEPSEEK_API_KEY=your_deepseek_api_key
export DEEPSEEK_GATEWAY_TOKEN=local_agent_token
deepseek-agent-gateway serve

Use this in OpenAI-compatible agent tools:

OPENAI_BASE_URL=http://127.0.0.1:8787/v1
OPENAI_API_KEY=local_agent_token

Test it:

curl http://127.0.0.1:8787/v1/chat/completions \
  -H "Authorization: Bearer local_agent_token" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Say hello"}]
  }'

Commands

deepseek-agent-gateway doctor
deepseek-agent-gateway config --gateway-token local_agent_token
deepseek-agent-gateway serve
deepseek-agent-gateway version

Endpoints

Endpoint Purpose
GET /health public local health check
GET /v1/models OpenAI-style model list, requires gateway token
POST /v1/chat/completions forwards to DeepSeek official API, requires gateway token

Agent Configuration

For tools that support OpenAI-compatible providers, use:

Base URL: http://127.0.0.1:8787/v1
API key:  your local gateway token
Model:    deepseek-chat or deepseek-reasoner

Agent Skill

This repository also ships an optional skill folder:

agent-skill/deepseek-agent-gateway

Use it with agents that support portable SKILL.md instructions. It gives agents a short, safe workflow for connecting to the local gateway and explicitly avoids web-login automation.

Security Model

This project is intentionally conservative:

  • no web login reverse engineering
  • no browser session scraping
  • no cookie extraction
  • no captcha or risk-control bypass
  • no credential collection UI
  • binds to 127.0.0.1 by default

DeepSeek's official API currently uses API key Bearer authentication. This gateway builds on that official path instead of trying to impersonate the DeepSeek web app.

Development

python3 -m pip install -e .
python3 -m unittest discover -s tests -v

License

MIT

About

Local DeepSeek API gateway for agent tools using the official API.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages