Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

OpenCode Integration with DeepSeek

OpenCode Integration with DeepSeek

OpenCode is an open-source AI programming assistant that supports running in various environments such as terminals and web pages.

In this section, we will configure DeepSeek as its AI backend to gain powerful intelligent assistance in programming.

OpenCode download and installation

First, please visit the OpenCode official download page according to your operating system https://opencode.ai/zh/downloadto obtain the installation package or installation script:

To avoid compatibility issues caused by version differences, we strongly recommend upgrading OpenCode to the latest version and ensuring the version number is ≥ v1.14.24.

The simplest installation and upgrade is one-command installation:

curl -fsSL https://opencode.ai/install | bash

After installation, you can run the following command in the terminal to verify the version:


opencode --version

If the version shown is lower than v1.14.24, please re-download the latest version for an overwrite installation.


Running and configuring DeepSeek

After OpenCode starts, you can quickly connect to DeepSeek through the built-in command-line interaction.

Basic information needed:

1. Start OpenCode

Enter the project directory (e.g., cd runoob-opencode-test) and run directly in the terminal:


opencode

This will enter the OpenCode interactive interface.

2. Enable connection configuration mode

Enter the following command in OpenCode's input box and press Enter:


/connect

The system will enter the connection configuration flow and prompt you to select an AI model provider.

3. Select DeepSeek as the provider

When the provider list appears, enter deepseek and confirm the selection.

4. Enter the DeepSeek API Key

Next, you need to enter the DeepSeek API Key. You can apply for and obtain your exclusive Key from the DeepSeek Open Platform.

Please enter DeepSeek API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxx

It is recommended to save the API Key in a secure location in advance and be careful not to leak it.

5. Select model

In the supported model list, select DeepSeek-V4-Pro to complete the configuration.

Maximum thinking effort setting max:

After configuration, all AI requests made through OpenCode will use the DeepSeek-V4-Pro model you specified to generate responses. You can immediately experience the efficiency and intelligence brought by DeepSeek in programming scenarios.

At this point, we have successfully integrated DeepSeek into OpenCode.


Example Test

Enter the project directory

cd runoob-opencode-test

Start OpenCode:


opencode

Input prompt:

生成一个企业级的专业 [游戏宣传] 落地页。
添加交互元素与动画效果,并确保页面具备完全响应式设计。
请给我带来惊喜,充分发挥创意,按步骤完成此项任务。

Let's see the result — it's quite good: