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_outputand DSH’stool-call/tool-result. - Reasoning Effort Levels: Supports levels such as
lowtoultra; explicit errors are raised for unsupported levels. - Reasoning Content: Supports displaying
reasoning_summaryevents. - 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_PROXYis effective (supports domain suffix matching).- Local addresses (
127.0.0.1,localhost) never go through the proxy. - Node’s global
fetchis 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
stopsequences; returnsUNSUPPORTED_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 |