Introduction

DeepSeek Harness (DSH) uses a plugin-based architecture that allows model providers to be extended through plugins. Developers typically need to write adapters for different model interfaces. The dsh-provider-copilot plugin addresses this pain point: it converts a GitHub Copilot subscription into a native DSH LLM provider, enabling you to use Copilot models in DSH’s unified model selector without modifying application code.

Plugin Overview

dsh-provider-copilot is a plugin that bridges a GitHub Copilot subscription to DSH. It is maintained by youngrock-labs and licensed under the MIT license. It operates as a cordis object plugin and registers routes via ctx.llm.registerAdapter.

Core Features

The plugin provides the following capabilities:
* Chat completion (streaming): Supports streaming responses.
* Model listing: Displays the intersection of the whitelist and the remote model list.
* Reasoning stream passthrough: Supports converting delta.reasoning_content into DSH reasoning blocks, rendered in the UI as collapsible “thinking” lines.
* Management commands: Provides /copilot login | logout | status commands.
* Observability: Supports JSONL-formatted logging, with fields governed by a strict whitelist.

Installation and Activation

Use the dsh plugin command to install the plugin package. After installation, DSH automatically discovers and registers the “Copilot (GitHub)” model group without requiring any modifications to DSH source code.

# 安装
dsh plugin --profile <your-profile> add github:youngrock-labs/dsh-provider-copilot

After installation, restart DSH or reload the configuration file to activate the plugin. The plugin is mounted immediately, and the “Copilot (GitHub)” group appears in the model selector.

Typical Usage

1. Command-Line Interaction

The plugin registers three management commands:

  • /copilot login
    Starts the device flow, printing a verification URL and a one-time code. The authorization process completes in the background.

  • /copilot status
    Displays the current credential source, expiration time, number of available models, and P50/P95 latency.

  • /copilot logout
    Clears cached, in-memory, and metric data.

2. Programmatic Invocation (BYOK)

You can use AuthManager, CopilotClient, and CopilotProvider programmatically.

import { AuthManager, CopilotClient, CopilotProvider } from "dsh-provider-copilot";

const auth = new AuthManager({
    byok: { kind: "github", token: process.env.MY_GITHUB_TOKEN! },
});

const client = new CopilotClient({
    getBearer: async () => {
        const s = await auth.getSession();
        return { token: s.token, endpoints: { api: s.endpoints.api } };
    },
});

const provider = new CopilotProvider({ client });

for await (const chunk of provider.stream({
    model: "gpt-4o-mini",
    messages: [{ role: "user", content: "hi" }],
})) {
    if (chunk.type === "text") process.stdout.write(chunk.text);
}

Notes and Limitations

  • Non-public API: The plugin uses api.github.com/copilot_internal/v2/token for token exchange. This endpoint is non-public and unstable; GitHub may modify or revoke it at any time. Use in production environments at your own risk.
  • User-Agent requirement: The User-Agent of HTTP requests must begin with GitHubCopilot*. Otherwise, the server returns a 403 error (which can look like an authentication error).
  • Scope permissions: The device flow only requests the read:user scope and does not request repository, codebase, or issue permissions.
  • Client ID: The plugin has a built-in official VSCode Copilot Chat OAuth client_id (Iv1.b507a08c87ecfe98). The generated token is used only for the user’s own subscription.
  • Tool calling not supported: The plugin does not implement tool or function calling; these capabilities are explicitly out of scope.

Ecosystem Context

A core principle of DSH is “everything is a plugin”. This plugin is hosted in the community directory and has no official affiliation with DeepSeek or High-Flyer Quant. Developers should inspect the source code before use to ensure it meets their project requirements.