Connect DeepSeek Harness with a B.AI API Key
This guide uses
deepseek-v4-flashas its configuration example. Other DeepSeek models available through B.AI can be connected to DeepSeek Harness in the same way when they support the OpenAI-compatible API. Use the exact B.AI model ID and select it from the available-model list whenever possible.The steps in this guide were verified with DeepSeek Harness Web (
@deepseek-ai/dsh 0.1.0-rc.7). The interface, configuration path, or parameter behavior may differ in other versions.
What is DeepSeek Harness?
DeepSeek Harness is an open-source AI agent tool from DeepSeek. In a selected local workspace, it can read files, modify code, run commands, and complete multi-step tasks.
Its interface and tools run locally, while model inference is provided by the B.AI cloud API. User prompts, code context, file excerpts, and tool results may therefore be sent to B.AI during a task.
Do not use it on projects containing trade secrets, personal data, or other sensitive information unless you are authorized to do so.
DeepSeek Harness is currently in development preview, and future releases may change its interface, configuration paths, or parameter behavior. See the official DeepSeek Harness project.
Before you begin
Prepare the following:
- A computer with Node.js installed
- A valid B.AI API Key
- Available B.AI account balance or model access
- A local folder for testing
Use a current Node.js LTS release where possible. In a terminal, run:
node --version
npm --version
If both commands return version information, Node.js and npm are ready to use.
Create a safe test workspace
The directory where DeepSeek Harness starts is a candidate for its default workspace. Do not start it directly from your home directory or a directory that contains important files.
Create a test directory first:
mkdir dsh-test
cd dsh-test
For an existing project, back it up first or work from a copy of the project.
Install and start DeepSeek Harness
Option 1: Start with npx
Run this command from the test directory:
npx @deepseek-ai/dsh web
On the first run, npm may download the required packages. When startup succeeds, open the following address in your browser:
http://127.0.0.1:3080
This address is available only on your local machine by default. Keep the terminal open while DeepSeek Harness is running. Press Ctrl+C in the terminal to stop it.
The official Web launch command is npx @deepseek-ai/dsh web, and the default port is 3080. See the official startup guide.
Option 2: Install globally
For frequent use, install it globally:
npm install -g @deepseek-ai/dsh
Then start it with:
dsh web
Prepare a B.AI API Key
Sign in to B.AI and create a new API Key from the API Key management page.
Keys commonly begin with sk-, for example:
sk-xxxxxxxxxxxxxxxx
Keep the API Key secure:
- Do not include a complete Key in screenshots, group chats, or public documents.
- Do not commit a Key to a public code repository.
- Use separate Keys for different projects where possible.
- If a Key is exposed, delete it immediately and create a replacement.
- In tutorial screenshots, mask Keys as
sk-****...****.
B.AI accepts either Bearer Token or x-api-key authentication. See the B.AI API and security reference.
Add B.AI in DeepSeek Harness
After opening DeepSeek Harness:
- Select Settings.
- Open Models.
- Select Add custom provider.
- Enter the following values.
| Setting | Value |
|---|---|
| Provider ID | b-ai |
| API key | Your own B.AI API Key |
| Display name | B.AI |
| API URL | https://api.b.ai/v1 |
| API protocol | openai-completions |
The Provider ID must start with lowercase letters. It uniquely identifies the provider and is used for saved sessions and credentials, so it cannot be changed after the provider is created. Use b-ai for this guide.
Paste only the Key itself into the API Key field:
sk-xxxxxxxxxxxxxxxx
Do not include the Bearer prefix:
Bearer sk-xxxxxxxxxxxxxxxx
Why does the API URL include /v1?
The B.AI API base URL is:
https://api.b.ai
Its OpenAI-compatible chat endpoint is:
POST /v1/chat/completions
For this reason, enter the following URL for the custom provider in DeepSeek Harness:
https://api.b.ai/v1
Why select openai-completions?
In DeepSeek Harness, openai-completions means its OpenAI-compatible protocol adapter. With the configuration above, it sends requests to B.AI's /v1/chat/completions endpoint.
Add a DeepSeek model
This guide uses DeepSeek V4 Flash as an example. Under Model catalog, select Get available models, choose deepseek-v4-flash, then select Add selected.
Fetching the available-model list is recommended because it uses the model IDs currently returned by B.AI. If you add a model manually, enter the exact B.AI model ID:
deepseek-v4-flash
Do not infer a model ID from a display name. Context-window and output-limit settings depend on the selected model and your task. This guide does not prescribe values for them; refer to the relevant B.AI model page when you need to review a model's capabilities.
Select Create provider to save the configuration.
Connect other DeepSeek models
DeepSeek V4 Flash is only a configuration example. You can use the same method for other DeepSeek models available through B.AI.
For a different model, select it from Get available models. If you add it manually, use its exact model ID and an optional display name.
You can confirm model IDs by:
- Selecting Get available models in DeepSeek Harness
- Reviewing the B.AI model directory
- Calling the B.AI
GET /v1/modelsendpoint
For example, the model ID for DeepSeek V4 Pro is:
deepseek-v4-pro
Model capabilities vary. Review the relevant B.AI model page when needed; do not assume a model's capacity from this example.
If you use only one model, keep only that model in the catalog.
Run your first test
After creating the provider:
- Return to the DeepSeek Harness home screen.
- Create a new conversation.
- Select the
B.AIprovider. - Select the configured DeepSeek model.
- Select Choose workspace, add the
dsh-testfolder, and select it as the current workspace. - Send a test message.
A new DeepSeek Harness Web UI does not select a workspace automatically. The message composer remains unavailable until you select one.
For the first message, use:
Reply only with “Connection successful.” Do not read, create, or modify any files.
If the model returns successfully, the following are working:
- DeepSeek Harness is running correctly.
- Your B.AI API Key is valid.
- The API URL and protocol are correct.
- The model ID can be called successfully.
Next, test read-only project analysis:
First inspect the current project in read-only mode. Explain which technology stack it uses, and do not modify any files.
After confirming the result, you can allow the agent to modify files or run commands.