Preface¶
Connecting models to DeepSeek Harness (DSH) typically involves configuring OpenAI-compatible endpoints or various API keys. However, the models used by Codex for ChatGPT subscribers are not hosted on api.openai.com. Requests must be routed to chatgpt.com/backend-api/codex, authenticated via an OAuth session obtained through Codex CLI login rather than an API key. Furthermore, the protocol is not the standard chat/completions, but rather a Responses-style input array accompanied by query parameters like client_version and specific headers. Generic OpenAI providers struggle to fully express these constraints.
Below is an introduction to the community plugin dsh-codex-provider (maintained by DPH-1121). It routes DSH’s model traffic to the same backend used by the Codex CLI, reusing the local login state from ~/.codex/auth.json. It allows the use of models such as GPT-6-Astra and the GPT-5.6 series within your subscription quota, supporting streaming output, tool calls, and image input.
What is this¶
dsh-codex-provider is a “Model Inference” plugin for DSH. Acting as a provider for Codex (ChatGPT) models, it reads the established OAuth session from the Codex CLI, sends requests to the Codex backend, and converts the Responses/SSE stream into events consumable by the DSH LLM interface. It does not generate token-based API bills; instead, it consumes the Codex quota associated with your ChatGPT subscription.
The plugin is distributed via the SkillHub catalog and GitHub. The current package version is 0.1.1, licensed under MIT. The environment requires Node ^22.19.0 || >=24.0.0 and compatibility with specific DSH core package versions (see engines and peerDependencies in the repository’s package.json).
Differences from Generic OpenAI Integration¶
The README summarizes the backend requirements based on actual testing in a table, with key points as follows:
| Requirement | Description |
|---|---|
| OAuth Session | Uses access/refresh tokens from ~/.codex/auth.json, not an API Key. |
| Request Body | Responses-style flat array of input items. |
client_version |
A required query parameter for /models; missing it results in a 400 error. The plugin auto-detects it from the local Codex installation by default, but it can be overridden in configuration. |
| Headers | The plugin includes relevant headers consistent with the Codex CLI (including OpenAI-Beta read from the local Codex binary) to mitigate risks if the backend strengthens validation in the future. |
Therefore, the plugin implements its own adapter, transport layer, and protocol conversion, rather than relying on the generic path of “filling in a base URL + API Key.”
Core Features¶
According to the README, the implemented capabilities include:
- Model Catalog: Fetches models in real-time from the backend
/models. Successful catalogs are cached and refreshed every 5 minutes by default. If the backend is unreachable, it falls back to a built-in table to ensure the selector never becomes empty. - Streaming Output: Converts SSE frames individually, displaying content as it is generated.
- Tool Calls: Bidirectional mapping of
function_call/function_call_outputto DSH’stool-call/tool-resultviacall_id. - Reasoning Levels: Maps backend-reported levels
low/medium/high/xhigh/max/ultra; unsupported levels trigger a clear error. - Reasoning Content: Converts
reasoning_summaryinto independent reasoning blocks. - Image Input: Resolves images via the attachment service into
input_image; degrades to visible placeholder text if reading fails. - Multi-turn History: Replays assistant turns and tool results according to the Responses specification.
- Usage Display: The Host side reads remaining subscription quota via
codexUsage(depends on the undocumented/usageendpoint; silently hides if parsing fails). - Network: Implements HTTP CONNECT to recognize
HTTPS_PROXY/ALL_PROXYandNO_PROXY. If the primary originchatgpt.comfails to connect, it can automatically try the backupchat.openai.com(only for transport layer failures; does not switch sources for business errors like 429).
To handle cases where SSE event names are not fully verified, the converter dispatches based on payload shape to reduce the probability of “backend renaming causing empty replies.”
Errors include stable code identifiers (e.g., MISSING_CREDENTIAL, AUTH, QUOTA, RATE_LIMIT) to facilitate handling by type in DSH. Specifically, subscription quota exhaustion (QUOTA) is deliberately distinguished from transient rate limiting (RATE_LIMIT) to prevent blind retries on long-term quota errors.
Installation and Activation¶
The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installation. The DSH ecosystem follows the principle of “everything is a plugin”; SkillHub is a community directory site and has no official affiliation with DeepSeek or High-Flyer.
Web Configuration¶
dsh plugin --profile web add dsh-codex-provider
Or install from a local directory (replace the path with your environment):
dsh plugin --profile web add D:\path\to\dsh-codex-provider
After installation, restart dsh web. Codex (ChatGPT) should appear under Settings → Models. Then, select a Codex model in the session model selector.
Headless Configuration¶
dsh plugin --profile headless add dsh-codex-provider
You can specify a default model in headless.patch.yml, for example:
- id: agent-default-model
config:
provider: codex
model: gpt-6-astra
Prerequisite: Codex CLI Login¶
You must complete the Codex CLI ChatGPT account login on your local machine first:
codex login
The plugin only reads ~/.codex/auth.json and does not write to it; refreshed tokens are used only in process memory and do not affect your regular codex login state. If the file does not exist or the login method is an API Key rather than a ChatGPT account, startup instructions for fixing the issue will be printed.
Configuration Example¶
You can edit this in Settings → Models → Codex (ChatGPT) or directly modify the llm-codex section in settings.yaml (changes are hot-reloaded, no restart required):
llm-codex:
enabled: true
baseURL: https://chatgpt.com/backend-api/codex
refreshMinutes: 5
streamIdleTimeoutMs: 120000
maxRequestImageBytes: 4194304
clientVersion: ''
catalogAdditions: []
Proxy settings can be configured for restricted networks, for example:
export HTTPS_PROXY=http://127.0.0.1:7897
Typical Usage and Troubleshooting¶
Normal Usage: After completing codex login and installing the plugin, set the provider to codex in your DSH Web or Headless configuration (if there is a routing conflict, the plugin may automatically switch to codex-provider and log a warning). Select a model from the catalog to start chatting. The plugin handles tool, image, and reasoning level processing based on backend metadata.
Codex row not visible: Verify that the plugin is installed via dsh plugin --profile web list, that auth.json represents a ChatGPT login, and check the logs for lines related to llm-codex:.
QUOTA: Indicates that the ChatGPT subscription Codex quota has been exhausted. You must wait for the reset time provided by the backend; this is not a plugin defect.
Uninstallation:
dsh plugin --profile web remove dsh-codex-provider
Use Cases and Notes¶
This is suitable for developers already using ChatGPT subscription + Codex CLI who want to connect DSH agents to the Codex model family (including streaming, tools, and multimodality) under the same subscription quota. It is not suitable for environments expecting pay-as-you-go billing via OpenAI API Keys or where codex login cannot be completed.
Known limitations include: usage must comply with OpenAI’s Acceptable Use Policy for subscriptions; the backend non-public contract may change; the stop sequence is explicitly unsupported (returns UNSUPPORTED_OPTION); development documentation notes that some SSE event names lack sufficient validation on actual successful turns, so the plugin uses shape-based dispatch for fault tolerance.
The repository provides npm test and networked check scripts requiring quota (test/live-transport.mjs, test/integration.mjs) for self-testing transport and integration behavior.
Conclusion¶
dsh-codex-provider connects DSH’s model layer to the same ChatGPT subscription backend used by the Codex CLI. The plugin encapsulates the OAuth session, Responses protocol, and transport details, allowing you to simply select the model within the Harness without configuring a separate API Key for Codex.
- Catalog Page: https://www.skillhub.cn/plugins/DPH-1121/dsh-codex-provider
- Source Code: https://github.com/DPH-1121/dsh-codex-provider