Skip to main content
Scraper API

How to Use DeepSeek Proxy: Setup Guide for API, R1, and Janitor AI [2026]

8 min read

How to Use DeepSeek Proxy: A Comprehensive Guide

The rise of DeepSeek V3 and the reasoning-focused DeepSeek R1 has revolutionized the open-source AI landscape. As users and developers migrate from closed-source models to DeepSeek, the need to understand proxy integration becomes critical. Whether you are a developer looking to switch your API infrastructure or a user trying to connect Janitor AI to a powerful LLM, using a DeepSeek proxy is the most efficient method.

This guide covers the technical implementation of DeepSeek proxies, distinguishing between API forwarding and local model hosting.

---

Understanding DeepSeek Proxy Architecture

Before configuring a proxy, it is essential to understand the architecture. In the context of DeepSeek, "proxy" generally refers to two distinct scenarios:

1. OpenAI-Compatible API Proxy: DeepSeek provides an official API that mimics the OpenAI standard. This allows you to "proxy" your existing OpenAI code to DeepSeek's servers by changing the endpoint URL. 2. Local/Cloud Relay Proxy: Tools like Janitor AI run in a browser environment and cannot directly hold secret API keys or make server-to-server requests due to security (CORS). A proxy server (local or remote) acts as a bridge, receiving the prompt from the web UI and forwarding it to the DeepSeek API or a locally running model.

Why Use DeepSeek V3 or R1?

According to recent benchmarks, DeepSeek V3 significantly outperforms GPT-4 in multilingual tasks, particularly in Chinese language benchmarks like C-Eval (86.5 vs 76.0) and Alder-Polyglot (49.6 vs 16.0). For users requiring high-level reasoning, DeepSeek R1 offers a performance profile comparable to OpenAI's o1, making it a highly sought-after model for complex logic tasks.

---

Method 1: Using the Official DeepSeek API (Developer Proxy)

The most common use case for developers is rerouting their applications to use DeepSeek instead of GPT-4. Because DeepSeek's API is OpenAI-compatible, the integration is seamless.

Prerequisites

  • DeepSeek API Key (Available from platform.deepseek.com)
  • Python 3.8+
  • OpenAI Python Library (pip install openai)
  • Step-by-Step Configuration

    Traditionally, interacting with a new API requires learning a new library. DeepSeek removes this friction by adhering to the OpenAI standard. Here is how to configure the proxy in your code.

    1. Python Code Snippet

    You can use the official openai library. You do not need to change your import statements; you simply change the base_url and the api_key.

    from openai import OpenAI
    

    Initialize the client pointing to DeepSeek's proxy endpoint

    client = OpenAI( api_key="YOUR_DEEPSEEK_API_KEY", base_url="https://api.deepseek.com" )

    Make a completion request using DeepSeek V3

    response = client.chat.completions.create( model="deepseek-chat", # Alias for DeepSeek V3 messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain the concept of a proxy server."}, ], stream=False )

    print(response.choices[0].message.content)

    2. cURL Example

    If you are testing from a terminal or configuring a no-code tool, use the following base_url structure:

    curl https://api.deepseek.com/v1/chat/completions \
    

    -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_DEEPSEEK_API_KEY" \ -d '{ "model": "deepseek-reasoner", "messages": [ {"role": "user", "content": "What is the capital of France?"} ], "stream": false }'

    Key Technical Note: When using DeepSeek R1 (the reasoning model), the model ID is deepseek-reasoner. The API response will contain a specific field for the reasoning chain (if enabled by permissions or specific parameters), allowing you to audit the model's logic process.

    ---

    Method 2: Using DeepSeek Proxy on Janitor AI

    A significant portion of the search volume regarding "DeepSeek proxy" comes from users of Janitor AI, a platform for roleplaying characters. Janitor AI acts as a frontend that needs a backend brain (LLM) to function.

    The CORS Problem

    Janitor AI runs in your browser. If you try to connect directly to DeepSeek's official API from the browser, you will encounter CORS (Cross-Origin Resource Sharing) errors. The browser blocks the request because DeepSeek's server does not recognize Janitor AI as an authorized origin.

    The Solution: Local Reverse Proxy

    To solve this, you need a proxy running on your local machine (localhost). Your browser talks to your localhost, and your localhost talks to DeepSeek.

    Option A: Running DeepSeek R1 Locally (The Free Method)

    For privacy and zero cost, you can run the distilled versions of DeepSeek R1 locally using Ollama. This is the preferred method for Janitor AI users.

    1. Install Ollama: Download it from ollama.com. 2. Pull the Model: Open your terminal and run:

        ollama run deepseek-r1:1.5b
    

    # Or for better quality: deepseek-r1:7b or deepseek-r1:8b

    *Note: Ensure your hardware has enough VRAM (8GB+ for 7b/8b models).*

    3. Configure Janitor AI: * Open Janitor AI settings. * Look for the "API" or "LLM Engine" settings. * Select OpenAI (Ollama mimics the OpenAI API). * Proxy URL: http://localhost:11434/v1 * API Key: ollama (This is a dummy key required by the UI, Ollama doesn't check it). * Model: deepseek-r1

    Option B: Third-Party Web Proxies

    If your computer cannot run the model locally, you must use a third-party proxy service. These services allow you to input your DeepSeek API key, and they provide a CORS-enabled endpoint.

  • Search for: "OpenAI Reverse Proxy" or "DeepSeek Proxy API".
  • Warning: Never input your official API key into a shady, unverified proxy website. You risk losing your API credits. Ideally, host your own simple proxy on a VPS (like DigitalOcean or Railway.app) using the Node.js script below.
  • ---

    Method 3: Hosting Your Own Node.js Proxy (Advanced)

    For maximum security and control, you can deploy a simple Node.js server that acts as a proxy. This server handles the API key secretly and forwards the request.

    // server.js
    

    const express = require('express'); const fetch = require('node-fetch');

    const app = express(); app.use(express.json());

    const PORT = process.env.PORT || 3000; const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY; // Store in env variable

    app.post('/proxy/chat/completions', async (req, res) => { try { const response = await fetch('https://api.deepseek.com/chat/completions', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': Bearer ${DEEPSEEK_API_KEY} }, body: JSON.stringify(req.body) });

    const data = await response.json(); res.json(data); } catch (error) { res.status(500).json({ error: 'Proxy Error', details: error.message }); } });

    app.listen(PORT, () => { console.log(DeepSeek Proxy running on port ${PORT}); });

    Deployment: 1. Push this code to GitHub. 2. Connect it to Render or Railway. 3. Add your DeepSeek API Key in the environment variables. 4. Use the provided URL (e.g., https://my-app.onrender.com/proxy) in Janitor AI or other tools.

    ---

    Comparison: DeepSeek vs. OpenAI Integration

    | Feature | DeepSeek Proxy | OpenAI Standard | | :--- | :--- | :--- | | Base URL | https://api.deepseek.com | https://api.openai.com/v1 | | Reasoning Model | deepseek-reasoner | o1-preview / o1-mini | | Standard Chat | deepseek-chat | gpt-4o / gpt-3.5-turbo | | Context Window | 64k (V3) | 128k (GPT-4o) | | CORS Support | No (Browser block) | No (Browser block) | | Cost Efficiency | Extremely High | High |

    Troubleshooting Common Issues

    1. 401 Unauthorized Error

  • Cause: Incorrect API Key or using the wrong Base URL.
  • Fix: Ensure base_url is exactly https://api.deepseek.com. Do not add /v1 at the end for some clients, as the library might add it automatically. Check that you didn't accidentally use your OpenAI key.
  • 2. Janitor AI Says "Failed to Fetch"

  • Cause: CORS issue or Proxy offline.
  • Fix: Ensure your local proxy (Ollama) is running in the terminal. If using a remote proxy, check that the URL includes the protocol (https://).
  • 3. Slow Response Times (DeepSeek R1)

  • Cause: R1 is a "reasoning" model. It "thinks" before it speaks. This is normal behavior.
  • Observation: You will see a delay of several seconds before the first token is generated. This is the model generating its internal reasoning chain.

Conclusion

Using a DeepSeek proxy is a straightforward process thanks to the model's OpenAI-compatible architecture. Developers can switch their infrastructure in minutes by updating the base_url, while power users can utilize tools like Ollama to run the powerful DeepSeek R1 locally for private, cost-free usage in interfaces like Janitor AI. As DeepSeek continues to outperform competitors in multilingual and coding benchmarks, setting up this proxy is an essential skill for any AI engineer or enthusiast in 2025.

Share: