DeepSeek Harness Plugin: Using Codex Subscription Models

Introduction

DeepSeek Harness (DSH) supports extensibility through plugins. For Codex CLI users who wish to use Codex subscription models (such as gpt-6-astra) directly within DSH, the issue of backend API incompatibility must be addressed. The dsh-codex-provider plugin bridges DSH with ChatGPT’s subscription backend through an adapter layer, reusing OAuth session credentials.

Plugin Overview

This plugin, maintained by HaydenSmith1121, is designed to provide DeepSeek Harness with support for Codex models. Rather than relying on an API Key, it reads the session information from the Codex CLI login (~/.codex/auth.json) and accesses subscription models via OAuth authentication.

The core value lies in: enabling the use of Codex models without purchasing an OpenAI API Key, with no additional per-token billing—only ChatGPT subscription quota is consumed.

Installation and Activation

Web Profile

Install the plugin:

dsh plugin --profile web add dsh-codex-provider

After installation, restart dsh web and navigate to Settings → Models to find the Codex (ChatGPT) option.

Headless Profile

dsh plugin --profile headless add dsh-codex-provider

After installation, you need to configure the default model in headless.patch.yml:

- id: agent-default-model
  config:
    provider: codex
    model: gpt-6-astra

Core Capabilities

The plugin implements the following features:

  • Streaming Output: Supports SSE frame-by-frame conversion, displaying content as it is generated.
  • Tool Calling: Supports mapping between function_call / function_call_output and DSH’s tool-call / tool-result.
  • Reasoning Effort Levels: Supports levels such as low to ultra; explicit errors are raised for unsupported levels.
  • Reasoning Content: Supports displaying reasoning_summary events.
  • Image Input: Supports uploading images and converting them to input_image.
  • Multi-turn History: Supports replaying assistant turns and tool results.
  • Usage Display: Reads remaining subscription quota.

Working Principles and Network

Authentication and Session

The plugin depends on the Codex CLI’s logged-in session. It reads the access/refresh tokens from ~/.codex/auth.json. The plugin only reads this file; it does not write data back or affect the login state of the codex command itself.

Network and Proxy

Since the Codex backend endpoint is not at api.openai.com and the backend cannot be reached directly in restricted network environments, the plugin implements its own HTTP CONNECT tunneling:

export HTTPS_PROXY=http://127.0.0.1:7897
  • NO_PROXY is effective (supports domain suffix matching).
  • Local addresses (127.0.0.1, localhost) never go through the proxy.
  • Node’s global fetch is not used; the transport layer is implemented independently.

Origin Failover

The Codex backend has two equivalent origin servers. If the connection to the primary origin (https://chatgpt.com/backend-api/codex) fails (TRANSPORT / TIMEOUT), the plugin automatically switches to the backup origin (https://chat.openai.com/backend-api/codex).

Model Discovery

The model catalog is not hardcoded but fetched in real time from the backend /models endpoint. The plugin detects the client_version from the local Codex installation to ensure request headers match those of the first-party client.

Known Limitations and Error Codes

Known Limitations

  • Subscription Dependency: Relies on the acceptable use policy of the ChatGPT subscription.
  • API Changes: The backend interface is not a public contract and may change at any time.
  • Stop Sequences: Does not support stop sequences; returns UNSUPPORTED_OPTION.
  • Usage Panel: Usage display depends on undocumented backend interfaces; silent degradation occurs if parsing fails.

Error Code Descriptions

DSH follows the routing code recovery strategy. The following are error classifications defined by the plugin:

Scenario Code Description
No readable Codex session MISSING_CREDENTIAL Prompts to run codex login
Credential rejected AUTH 401/403, invalidates cached token
Subscription quota exhausted QUOTA usage_limit_reached, wait for reset
Request rate limited RATE_LIMIT Transient 429, retryable
Context exceeded CONTEXT_WINDOW_EXCEEDED
Backend does not offer model UNKNOWN_MODEL
Model does not support images UNSUPPORTED_CONTENT
Stop sequence not supported UNSUPPORTED_OPTION Explicit rejection
Model does not support reasoning level UNSUPPORTED_REASONING_EFFORT
Connection/Timeout/Proxy rejected TRANSPORT / TIMEOUT / PROXY_REJECTED
Model returns empty response EMPTY_RESPONSE Safe to retry

References

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye