> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect DeepSeek Harness to Coding Plan

> DeepSeek AI integration guide - Ace Data Cloud

[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) is a local coding agent that can inspect a workspace, invoke tools, and run commands while using an OpenAI-compatible Chat Completions endpoint for model requests.

> This guide applies to `deepseek-harness-sdk==0.1.0rc6` and `deepseek-harness-runtime-bin==0.1.0rc6`. Repeat the read-only fixture test below after upgrading the client.

## Configuration

| Item | Value |
| - | - |
| API Base URL | `https://api.acedata.cloud/v1` |
| Model | `deepseek-v4-pro` |
| Protocol | Streaming OpenAI-compatible Chat Completions |
| Capabilities | Text, reasoning, function tools, local Bash tool loop, and usage reporting |

The model catalog changes over time. Query it with your dedicated Coding Plan key before setup:

```bash theme={null}
curl https://api.acedata.cloud/v1/models \
  -H "Authorization: Bearer $ACEDATACLOUD_API_KEY"
```

Confirm that `deepseek-v4-pro` is present. Do not substitute `deepseek-v4-flash` for the tool-mode example: its multi-turn reasoning history and tool replay did not pass this pinned-version verification.

## 1. Get a dedicated Coding key

Open your [Coding Plan application](https://platform.acedata.cloud/console/applications), then create or copy the API key attached to that Coding Application. Coding Plan does not consume the general balance, so a key from another application does not prove plan access.

Export the key only in the current shell:

```bash theme={null}
export ACEDATACLOUD_API_KEY="PASTE_YOUR_CODING_KEY_HERE"
export DEEPSEEK_BASE_URL="https://api.acedata.cloud/v1"
export DEEPSEEK_API_KEY="$ACEDATACLOUD_API_KEY"
```

Never commit the key or include it in scripts, screenshots, or session artifacts.

## 2. Create a disposable workspace

The bundled Harness runtime includes a local Bash tool. Do not point the first test at a real repository or your home directory. Create a disposable directory with no secrets:

```bash theme={null}
mkdir -p /tmp/deepseek-harness-demo/workspace
mkdir -p /tmp/deepseek-harness-demo/sessions
printf 'compatibility fixture\n' > /tmp/deepseek-harness-demo/workspace/fixture.txt
python3 -m venv /tmp/deepseek-harness-demo/venv
/tmp/deepseek-harness-demo/venv/bin/pip install \
  "deepseek-harness-sdk==0.1.0rc6"
```

If your network uses a private PyPI mirror, make sure the same `deepseek-harness-runtime-bin` version is available. Do not broaden filesystem access with `danger-full-access`; this example passes only the disposable directory as `cwd`.

## 3. Run the official Python SDK

Save this as `/tmp/deepseek-harness-demo/run.py`:

```python theme={null}
import os

from deepseek_harness import DeepSeekHarness

with DeepSeekHarness(
    provider="deepseek-official",
    model="deepseek-v4-pro",
    max_tokens=160,
    cwd="/tmp/deepseek-harness-demo/workspace",
    session_root="/tmp/deepseek-harness-demo/sessions",
    base_url=os.environ["DEEPSEEK_BASE_URL"],
    api_key=os.environ["DEEPSEEK_API_KEY"],
    request_timeout_seconds=180,
) as harness:
    result = harness.run(
        "Read fixture.txt once, then reply with exactly: sdk-harness-ok",
        session_id="acedatacloud-compat",
    )

print(result.final_response)
print(result.finish_reason)
```

Run it:

```bash theme={null}
/tmp/deepseek-harness-demo/venv/bin/python \
  /tmp/deepseek-harness-demo/run.py
```

Expected output:

```text theme={null}
sdk-harness-ok
completed
```

This verifies Bearer authentication, `/v1/chat/completions`, SSE, reasoning, tool calls, and tool-result replay. Delete `/tmp/deepseek-harness-demo` when finished. Treat retained session files as sensitively as source code because they may contain workspace context.

## Troubleshooting

* **401:** export `ACEDATACLOUD_API_KEY` in the same shell that launches Python.
* **403 or quota error:** confirm that the key belongs to the active Coding Application and that Credits remain.
* **Model not listed:** query `/v1/models` again instead of relying on an old screenshot.
* **`reasoning_content` or tool replay error:** use the pinned SDK/runtime versions and `deepseek-v4-pro`.
* **Unexpected repeated tools:** stop tasks with side effects and rerun this read-only fixture first.
* **Installation error:** confirm Python 3.10+, supported OS/architecture, and matching SDK/runtime versions.

## Scope

This guide verifies the local Python SDK with text and tool loops over Chat Completions. Images, Files API, `/v1/responses`, `/v1/messages`, remote workspaces, and a hosted sandbox are outside this guide. Workspace permissions and local command risks remain the responsibility of the machine running Harness.

## Official references

* [DeepSeek Harness repository](https://github.com/deepseek-ai/deepseek-harness)
* [DeepSeek Harness Python SDK](https://github.com/deepseek-ai/deepseek-harness/blob/master/python/sdk/README.md)

Return to the [Coding Plan Setup Center](https://platform.acedata.cloud/documents/coding-plan-integration).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.