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
- Open Dashboard and create an API key.
- Save the full key when it appears. It is shown once.
- 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"}]
}'
Endpoint summary
| Interface | Base URL | Auth | Main endpoint |
|---|---|---|---|
| OpenAI compatible | https://deeprelayapi.cloud/v1 | Authorization: Bearer sk-dr... | POST /chat/completions |
| Anthropic compatible | https://deeprelayapi.cloud | x-api-key: sk-dr... or tool token env | POST /v1/messages |
Models
| Model | Use it for | Recommended interface |
|---|---|---|
deepseek-v4-pro | Coding, refactors, reasoning-heavy work, agent tasks. | OpenAI or Anthropic |
deepseek-v4-flash | Fast answers, low-cost chat, simple coding tasks. | OpenAI or Anthropic |
deepseek-chat | Legacy compatibility. | OpenAI |
deepseek-reasoner | Legacy reasoning compatibility. | OpenAI |
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);
/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)
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.
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.
curl -fsSL https://deeprelayapi.cloud/install/deeprelay.sh | bash
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"
}
}
/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"
}
Cursor
https://deeprelayapi.cloud/v1sk-dr...deepseek-v4-pro for coding, deepseek-v4-flash for cheaper quick edits.Cline
- Install or update the Cline extension in VS Code.
- Open Cline settings and select an OpenAI-compatible provider.
- Set Base URL to
https://deeprelayapi.cloud/v1. - Set API Key to your
sk-dr...key. - Set model to
deepseek-v4-pro.
OPENAI_BASE_URL=https://deeprelayapi.cloud/v1
OPENAI_API_KEY=sk-drYOUR_KEY
MODEL=deepseek-v4-pro
TRAE
- Open TRAE settings and go to the model/provider page.
- Add a custom OpenAI-compatible provider.
- Use
https://deeprelayapi.cloud/v1as the base URL. - Use your
sk-dr...key and adddeepseek-v4-proas the model. - Run TRAE's built-in model test. If it fails, first verify the key with the curl command in Quick start.
Other tools
| Tool type | Use this setting |
|---|---|
| OpenAI-compatible tools | Base URL https://deeprelayapi.cloud/v1, API key sk-dr..., model deepseek-v4-pro. |
| Anthropic-compatible tools | Base URL https://deeprelayapi.cloud, token/key sk-dr..., model deepseek-v4-pro. |
| Tools with fixed model menus | Choose 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
| Error | Likely cause | Fix |
|---|---|---|
| 401 | Wrong key, copied masked key, or deleted key. | Create a new key in Dashboard and save the full sk-dr... value. |
| Insufficient balance | Your DeepRelay account credit is empty. | Recharge before calling paid models. |
| Model not found | Wrong model name or a tool is forcing a native Claude/OpenAI model. | Use deepseek-v4-pro or deepseek-v4-flash. |
| Claude Code fails | Base 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 confusing | Tools show tokens; DeepRelay bills by quota translated into account credit. | Use Dashboard Billing & Usage for money view and model-level usage. |