How to Use DeepSeek API with Dify

Dify ?? DeepSeek API ??

Dify is an open-source LLM app development platform. Use our DeepSeek API Gateway as the model provider to build AI workflows, chatbots, and agents.

Third-party API gateway. Not affiliated with or endorsed by DeepSeek. Not an official DeepSeek service.

Base URL

https://modelrelayapis.cc/v1

Available Models

Setup Steps

  1. In Dify, go to Settings ? Model Providers.
  2. Add a new OpenAI-API-compatible provider.
  3. Set API Base URL to https://modelrelayapis.cc/v1.
  4. Enter your sk-gateway API Key.
  5. Add model name: deepseek-v4-flash (or deepseek-v4-pro for Pro plan).
  6. Save and use in your Dify apps.

Python Example

from openai import OpenAI

client = OpenAI(
    base_url="https://modelrelayapis.cc/v1",
    api_key="sk-gateway-YOUR-KEY"
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Hello, how are you?"}]
)

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

Quick curl Test

curl https://modelrelayapis.cc/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-gateway-YOUR-KEY"   -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Hello"}]}'

Common Errors

HTTPMeaning
401Invalid or missing API key
402API budget exhausted ? buy a new package
403Model not allowed for your plan
429Rate limit exceeded
500/502Gateway error ? try again or contact support

Get Your DeepSeek API Key ? From $1

Instant key delivery after PayPal payment. Check your usage anytime on the Dashboard.

View Plans & Buy