DDeepRelay Docs
Developer manual

Use DeepSeek through one DeepRelay key.

DeepRelay gives you an OpenAI-compatible endpoint and an Anthropic Messages-compatible endpoint. Create a sk-dr... key in Dashboard, add account credit, then point your SDK or coding tool at DeepRelay.

Quick start

1. Get a key

  1. Open Dashboard and create an API key.
  2. Save the full key when it appears. It is shown once.
  3. Keep the key outside source code. Use environment variables.
export DEEPRELAY_API_KEY="sk-drYOUR_KEY"

2. Call the API

curl https://deeprelayapi.cloud/v1/chat/completions \
  -H "Authorization: Bearer $DEEPRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
A successful response means your key, balance, model route, and upstream channel are all working.

Endpoint summary

InterfaceBase URLAuthMain endpoint
OpenAI compatiblehttps://deeprelayapi.cloud/v1Authorization: Bearer sk-dr...POST /chat/completions
Anthropic compatiblehttps://deeprelayapi.cloudx-api-key: sk-dr... or tool token envPOST /v1/messages

Models

ModelUse it forRecommended interface
deepseek-v4-proCoding, refactors, reasoning-heavy work, agent tasks.OpenAI or Anthropic
deepseek-v4-flashFast answers, low-cost chat, simple coding tasks.OpenAI or Anthropic
deepseek-chatLegacy compatibility.OpenAI
deepseek-reasonerLegacy reasoning compatibility.OpenAI
For coding tools, start with deepseek-v4-pro. Switch to deepseek-v4-flash only when speed and cost matter more than reasoning depth.

OpenAI-compatible API

Use this path when your SDK or framework already supports OpenAI Chat Completions.

Environment

export OPENAI_BASE_URL="https://deeprelayapi.cloud/v1"
export OPENAI_API_KEY="$DEEPRELAY_API_KEY"

Python

from openai import OpenAI

client = OpenAI(
    base_url="https://deeprelayapi.cloud/v1",
    api_key="sk-drYOUR_KEY",
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "user", "content": "Write a Python merge sort."}
    ],
)

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

Node.js

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://deeprelayapi.cloud/v1",
  apiKey: process.env.DEEPRELAY_API_KEY,
});

const response = await client.chat.completions.create({
  model: "deepseek-v4-pro",
  messages: [{ role: "user", content: "Explain rate limits." }],
});

console.log(response.choices[0].message.content);
Do not add another /v1 in SDK code when your base URL already ends with /v1.

Anthropic-compatible Messages API

Use this path for Claude Code and tools that expect Anthropic Messages. The base URL is https://deeprelayapi.cloud; the tool adds /v1/messages.

curl

curl https://deeprelayapi.cloud/v1/messages \
  -H "x-api-key: $DEEPRELAY_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello from Messages API."}
    ]
  }'

Python Anthropic SDK

import anthropic

client = anthropic.Anthropic(
    base_url="https://deeprelayapi.cloud",
    api_key="sk-drYOUR_KEY",
)

message = client.messages.create(
    model="deepseek-v4-pro",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Write a short TypeScript example."}
    ],
)

print(message.content[0].text)
If an Anthropic tool refuses custom model names, use the OpenAI-compatible path or set the tool's model override to deepseek-v4-pro.

One-click setup for AI coding tools

There are two setup paths. The AI-assisted path gives an agent exact instructions. The command-line path writes local config files for Claude Code and OpenCode.

AI-assisted setup

Copy this into Claude Code, OpenCode, Cursor Agent, Cline, or another local agent. Replace the key before sending it.

Prompt
Use https://deeprelayapi.cloud/docs/install/deeprelay.md to connect DeepRelay to my local AI coding tools.

My DeepRelay API key is: sk-drYOUR_KEY

Do not print the full key. Configure Claude Code and OpenCode if they are installed. Back up any existing config before changing it. After setup, verify with a low-cost model or a non-billing status command.

Command-line setup

Run this on your own machine. The script asks for your key and does not send it anywhere except DeepRelay validation calls.

Installer
curl -fsSL https://deeprelayapi.cloud/install/deeprelay.sh | bash
This is a local configuration helper, not account creation. Create your DeepRelay account and API key in Dashboard first.

Claude Code

Claude Code uses the Anthropic-compatible route. Clear old Anthropic variables first, then point Claude Code at DeepRelay.

Shell setup

unset ANTHROPIC_AUTH_TOKEN
unset ANTHROPIC_API_KEY
unset ANTHROPIC_BASE_URL

export ANTHROPIC_BASE_URL="https://deeprelayapi.cloud"
export ANTHROPIC_AUTH_TOKEN="$DEEPRELAY_API_KEY"
export ANTHROPIC_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
export API_TIMEOUT_MS="3000000"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

claude

~/.claude/settings.json

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://deeprelayapi.cloud",
    "ANTHROPIC_AUTH_TOKEN": "sk-drYOUR_KEY",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "ANTHROPIC_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash"
  }
}
Verify inside Claude Code with /status and /model. The base URL should be DeepRelay and the model should be deepseek-v4-pro.

OpenCode

OpenCode can use provider configuration files and environment variables. The safest first setup is project-local: keep DeepRelay config in the repo you are coding in, not in a global shared file.

Environment

export DEEPRELAY_API_KEY="sk-drYOUR_KEY"
export OPENAI_BASE_URL="https://deeprelayapi.cloud/v1"
export OPENAI_API_KEY="$DEEPRELAY_API_KEY"

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "deeprelay": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "DeepRelay",
      "options": {
        "baseURL": "https://deeprelayapi.cloud/v1",
        "apiKey": "{env:DEEPRELAY_API_KEY}"
      },
      "models": {
        "deepseek-v4-pro": {},
        "deepseek-v4-flash": {}
      }
    }
  },
  "model": "deeprelay/deepseek-v4-pro"
}
OpenCode config support changes across releases. If your version rejects custom provider config, keep the environment variables above and choose an OpenAI-compatible provider in the TUI.

Cursor

WhereCursor Settings -> Models -> OpenAI API Key / Override OpenAI Base URL.
Base URLhttps://deeprelayapi.cloud/v1
API Keysk-dr...
Modeldeepseek-v4-pro for coding, deepseek-v4-flash for cheaper quick edits.
Cursor's OpenAI base URL override can affect other OpenAI-backed features. If built-in models stop working, remove the override and use DeepRelay only in a separate profile or tool.

Cline

  1. Install or update the Cline extension in VS Code.
  2. Open Cline settings and select an OpenAI-compatible provider.
  3. Set Base URL to https://deeprelayapi.cloud/v1.
  4. Set API Key to your sk-dr... key.
  5. Set model to deepseek-v4-pro.
OPENAI_BASE_URL=https://deeprelayapi.cloud/v1
OPENAI_API_KEY=sk-drYOUR_KEY
MODEL=deepseek-v4-pro

TRAE

  1. Open TRAE settings and go to the model/provider page.
  2. Add a custom OpenAI-compatible provider.
  3. Use https://deeprelayapi.cloud/v1 as the base URL.
  4. Use your sk-dr... key and add deepseek-v4-pro as the model.
  5. Run TRAE's built-in model test. If it fails, first verify the key with the curl command in Quick start.

Other tools

Tool typeUse this setting
OpenAI-compatible toolsBase URL https://deeprelayapi.cloud/v1, API key sk-dr..., model deepseek-v4-pro.
Anthropic-compatible toolsBase URL https://deeprelayapi.cloud, token/key sk-dr..., model deepseek-v4-pro.
Tools with fixed model menusChoose custom model if available. If not, the tool may not support DeepRelay yet.

Streaming

curl https://deeprelayapi.cloud/v1/chat/completions \
  -H "Authorization: Bearer $DEEPRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "stream": true,
    "messages": [{"role": "user", "content": "Stream a short answer."}]
  }'

Common errors

ErrorLikely causeFix
401Wrong key, copied masked key, or deleted key.Create a new key in Dashboard and save the full sk-dr... value.
Insufficient balanceYour DeepRelay account credit is empty.Recharge before calling paid models.
Model not foundWrong model name or a tool is forcing a native Claude/OpenAI model.Use deepseek-v4-pro or deepseek-v4-flash.
Claude Code failsBase URL includes extra /v1 or old Anthropic env vars override the setup.Set ANTHROPIC_BASE_URL=https://deeprelayapi.cloud and clear old vars.
Tool works but costs look confusingTools show tokens; DeepRelay bills by quota translated into account credit.Use Dashboard Billing & Usage for money view and model-level usage.