# DeepRelay local tool setup guide

Use this guide when a user wants to connect DeepRelay to local AI coding tools such as Claude Code, OpenCode, Cursor, Cline, TRAE, or other OpenAI-compatible tools.

## What DeepRelay provides

- OpenAI-compatible base URL: `https://deeprelayapi.cloud/v1`
- Anthropic-compatible base URL: `https://deeprelayapi.cloud`
- API key format: `sk-dr...`
- Recommended coding model: `deepseek-v4-pro`
- Lower-cost quick model: `deepseek-v4-flash`

DeepRelay does not give users a DeepSeek official API key. The user creates a DeepRelay key in the DeepRelay Dashboard and uses that key in tools.

## Safety rules for agents

- Do not print the full API key after the user gives it to you.
- Back up existing config files before editing.
- Prefer project-local config when a tool supports it.
- Do not delete or overwrite unrelated provider config.
- Do not run a paid model call unless the user explicitly agrees.
- If verifying without spending credit, check config files and use non-billing status commands first.

## One-command installer

```bash
curl -fsSL https://deeprelayapi.cloud/install/deeprelay.sh | bash
```

The installer asks for the user's `sk-dr...` key and writes:

- `~/.deeprelay/env`
- `~/.claude/settings.json` for Claude Code
- `./opencode.json` in the current project directory

## Claude Code setup

Use Anthropic-compatible settings:

```bash
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"
```

If editing `~/.claude/settings.json`, merge this into the `env` object:

```json
{
  "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:

```text
/status
/model
```

## OpenCode setup

Use a project-local `opencode.json`:

```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"
}
```

Also set:

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

If a user's OpenCode version rejects custom provider config, keep the environment variables and choose an OpenAI-compatible provider in the TUI.

## Cursor, Cline, TRAE, and other OpenAI-compatible tools

Use:

```text
Base URL: https://deeprelayapi.cloud/v1
API Key: sk-dr...
Model: deepseek-v4-pro
```

For tools that support Anthropic-compatible API only:

```text
Base URL: https://deeprelayapi.cloud
API Key or auth token: sk-dr...
Model: deepseek-v4-pro
```

## Basic verification

Use this only when the user agrees to make a small paid call:

```bash
curl https://deeprelayapi.cloud/v1/chat/completions \
  -H "Authorization: Bearer $DEEPRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Say ok"}],"max_tokens":8}'
```

Expected result: HTTP 200 and a short model response. If it fails with 401, the key is wrong. If it fails with insufficient balance, the user needs to recharge.
