DEV Community

Liandanxia
Liandanxia

Posted on

How to Use DeepSeek in Claude Code and OpenCode

How to Use Liandanxia DeepSeek Models in Claude Code and OpenCode

This guide explains how to connect Liandanxia's DeepSeek models to Claude Code and OpenCode.

Step 1: Register a Liandanxia Account and Create an API Key

First, sign up for a Liandanxia account and create an API key from your account dashboard.

Keep your API key secure. It should look similar to:

sk-your_api_key
Enter fullscreen mode Exit fullscreen mode

Step 2: Install Claude Code or OpenCode

You can use Liandanxia models with either Claude Code or OpenCode.


Claude Code

Install Claude Code on Windows

Open a cmd window and run:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Enter fullscreen mode Exit fullscreen mode

Wait for the installation to complete.

Configure Environment Variables

Claude Code can be pointed to Liandanxia's API endpoint by setting the following environment variables.

Windows CMD

setx ANTHROPIC_BASE_URL "https://api.liandanxia.io"
setx ANTHROPIC_AUTH_TOKEN "sk-your_api_key"
setx ANTHROPIC_MODEL "deepseek-v4-pro"
Enter fullscreen mode Exit fullscreen mode

After running these commands, close the current terminal window and open a new one for the changes to take effect.

Then start Claude Code:

claude
Enter fullscreen mode Exit fullscreen mode

macOS / Linux / Git Bash

export ANTHROPIC_BASE_URL="https://api.liandanxia.io"
export ANTHROPIC_AUTH_TOKEN="sk-your_api_key"
export ANTHROPIC_MODEL="deepseek-v4-pro"
Enter fullscreen mode Exit fullscreen mode

Then run:

claude
Enter fullscreen mode Exit fullscreen mode

Claude Code should now use the Liandanxia DeepSeek model.


OpenCode

Install OpenCode

On macOS, Linux, WSL, or Git Bash, run:

curl -fsSL https://opencode.ai/install | bash
Enter fullscreen mode Exit fullscreen mode

If you are using Windows CMD, consider running this command inside Git Bash or WSL.

Configure OpenCode

OpenCode uses the provider config key, not providers.

Create or update an opencode.json file in your project root:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "ldx/deepseek-v4-pro",
  "provider": {
    "ldx": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LDX",
      "options": {
        "baseURL": "https://api.liandanxia.io/v1",
        "apiKey": "sk-your_api_key"
      },
      "models": {
        "deepseek-v4-pro": {},
        "deepseek-v4-flash": {}
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

After saving the file, run OpenCode from your project directory:

opencode
Enter fullscreen mode Exit fullscreen mode

Recommended: Use an Environment Variable for Your API Key

To avoid storing your API key directly in your project configuration, use an environment variable instead.

macOS / Linux / Git Bash

export LDX_API_KEY="sk-your_api_key"
Enter fullscreen mode Exit fullscreen mode

Windows CMD

setx LDX_API_KEY "sk-your_api_key"
Enter fullscreen mode Exit fullscreen mode

After using setx, restart your terminal.

Then update your opencode.json file:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "ldx/deepseek-v4-pro",
  "provider": {
    "ldx": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LDX",
      "options": {
        "baseURL": "https://api.liandanxia.io/v1",
        "apiKey": "{env:LDX_API_KEY}"
      },
      "models": {
        "deepseek-v4-pro": {},
        "deepseek-v4-flash": {}
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Now OpenCode will read your Liandanxia API key from the LDX_API_KEY environment variable.


Model Options

You can switch models by changing the model field in opencode.json.

For example:

"model": "ldx/deepseek-v4-pro"
Enter fullscreen mode Exit fullscreen mode

or:

"model": "ldx/deepseek-v4-flash"
Enter fullscreen mode Exit fullscreen mode

Use deepseek-v4-pro when you need stronger reasoning and higher-quality coding performance. Use deepseek-v4-flash when you want faster responses and lower cost.


Summary

Claude Code configuration:

ANTHROPIC_BASE_URL=https://api.liandanxia.io
ANTHROPIC_AUTH_TOKEN=sk-your_api_key
ANTHROPIC_MODEL=deepseek-v4-pro
Enter fullscreen mode Exit fullscreen mode

OpenCode configuration:

{
  "model": "ldx/deepseek-v4-pro",
  "provider": {
    "ldx": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.liandanxia.io/v1",
        "apiKey": "{env:LDX_API_KEY}"
      },
      "models": {
        "deepseek-v4-pro": {},
        "deepseek-v4-flash": {}
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Once configured, you can use Liandanxia's DeepSeek models directly inside Claude Code or OpenCode.

Top comments (0)