Skip to main content

dsh-codex-provider

8Stars1Forks1Issues0Watchers

Connect DSH to OpenAI Codex via device code OAuth, run Codex models using ChatGPT Plus/Pro subscription—no API Key required.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
License
MIT
Branch
main
chatgptcodexdeepseek-harnessdsh-pluginoauthopenai

Install

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

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin Hu9956/dsh-codex-provider for me: review the repository at https://github.com/Hu9956/dsh-codex-provider first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Pitch

Bring OpenAI Codex to DSH: Log in to your ChatGPT account via device code OAuth, connect your ChatGPT Plus/Pro subscription quota to DSH's built-in openai-codex model routing, no API Key required.

Core Capabilities

  • Device Code OAuth Login: Click login in "Settings → Providers", complete authorization on the OpenAI authorization page using the device code displayed on the page, no API Key required
  • Reuse Codex CLI Login State: Directly read existing access/refresh tokens from local ~/.codex/auth.json, skipping re-authorization
  • Automatic Token Refresh: Background check every minute for access token expiration, automatically rotate using refresh_token when less than 10 minutes remaining (refresh_token is also refreshed together)
  • Cross-Instance Refresh Lock: Ensure serialized refresh across multiple DSH processes on the same machine via ~/.dsh/.codex-provider-refresh.lock file lock, preventing token corruption
  • Provider Management Panel: Display masked account, subscription (Plus/Pro), token expiration time after login, support one-click logout
  • Auto-Activate Built-in Codex Routing: After successful login, write OPENAI_CODEX_API_KEY to llm-pi-ai.providers.openai-codex.apiKeyEnv, Codex models like gpt-5.4 become directly selectable in the model selector

Technical Implementation

  • Language: JavaScript (ESM, "type": "module"), source code has no TS type annotations but depends on DSH's Typert decorators at runtime
  • Key Dependencies: @deepseek-ai/dsh-typert-protocol (Remote/TypertRemoteService, host-client remote calls), @deepseek-ai/dsh-credentials (credential storage), @deepseek-ai/dsh-settings (writing to llm-pi-ai.providers.openai-codex.apiKeyEnv)
  • Architecture Pattern: Dual-end plugin + Typert remote service. Host-side CodexGateway inherits TypertRemoteService exposing six remote methods: status/loginStart/loginStatus/loginCancel/importExisting/logout; client-side uses __ModuleLoader__ format to register UI components and $mount the same remote description, achieving browser-side not touching original tokens
  • Entry Files: lib/index.js (host), lib/client.js (web bundle), injected into DSH bundle by cordis.patch.yml during installation

Use Cases

Users who have a ChatGPT Plus/Pro subscription and want to add Codex series models (gpt-5.4, gpt-5.5, gpt-5.6-*) to the DSH model selector. The pain point is that DSH's built-in openai-codex routing only accepts credential references without a built-in login entry; without this plugin, users either pay for API Key billing or manually maintain tokens. This plugin completes the last mile: login UI, token refresh, and credential recycling. Also suitable for users already running Codex CLI who want to reuse local login state and avoid repeated authorization.

Prerequisites & Compatibility

DependencyMinimum VersionDescription
@deepseek-ai/dsh>=0.1.0-rc.6Declared via peerDependencies (typert-protocol / credentials / settings and other host packages all require same version)
@deepseek-ai/cordis^4.0.1Host plugin runtime, marked as optional in peerDependencies
Node.js>=22package.json engines.node hard requirement
React^18.2.0Client rendering dependency, only needed when using web profile
PlatformCross-platformHost code has no platform binding; user-facing only supports DSH web profile (client.platform = "web"), CLI/TUI scenarios not covered by this plugin
Native ModulesNoneAll pure JS + Node built-in modules (node:fs / node:os / node:path) + fetch

Installation

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

During installation, cordis.patch.yml is automatically written, no manual editing needed. After completion, restart dsh web, and the Providers section will appear in the "Settings" sidebar for use.

Configuration Options

This plugin requires no additional configuration. All runtime state (access token, refresh token, login session) is written via DSH credential store and settings, not reading any Schema fields.

ConfigTypeDescriptionDefault
——This plugin requires no additional configuration—

Advanced info (for reference only, not declared as user config in source): Refresh lock file path is determined by environment variable DSH_HOME, default ~/.dsh/.codex-provider-refresh.lock; credential reference is written to llm-pi-ai.providers.openai-codex.apiKeyEnv, device code login entry at https://auth.openai.com/codex/device.

FAQ

Q: Do I need an OpenAI API Key?

A: No. This plugin consumes ChatGPT Plus/Pro subscription quota, using the same OAuth channel as Codex CLI, not API billing.

Q: I already have Codex CLI installed, can I reuse the login?

A: Yes. Click "Import local Codex CLI login state" on the providers page, the plugin directly reads ~/.codex/auth.json, no need to go through device code authorization again.

Q: Login failed with "device code authorization denied" prompt?

A: You need to first enable "Enable device code authorization for Codex" switch in ChatGPT web "Settings → Account security and login". It is recommended to turn it off after successful login, and turn it on again before next login.

Q: Will tokens refresh automatically? Do I need manual operations?

A: Automatic. Host side checks every 60 seconds, uses refresh_token to renew when access token remaining lifetime is below 10 minutes (refresh_token is also rotated), multiple DSH processes use file locks to serialize and avoid races.

Q: Where are credentials stored? Can the browser see them?

A: Credentials are written to DSH credential store (keys: OPENAI_CODEX_API_KEY and OPENAI_CODEX_REFRESH_TOKEN), browser side only gets masked account ID, subscription type, expiration time and other status info, original tokens are not delivered to frontend.

Q: Will I be logged out if I run Codex CLI at the same time?

A: They share the same OAuth session. After either side refreshes the token, the other side's old refresh_token may become invalid; just re-run codex login on the Codex CLI side to restore.

Q: Which models are supported?

A: Determined by the built-in openai-codex routing in the current DSH version, README examples include gpt-5.4, gpt-5.5, gpt-5.6-*, etc.; specific visibility also depends on your OpenAI account permissions.

Q: How to uninstall?

A: Just remove this plugin via dsh. Host side will automatically clear the two credential store keys and revoke the apiKeyEnv reference in settings; after restart, the "Providers" section in settings disappears.

Difficulty Level

Beginner — Just click "Log in with OpenAI account" once in "Settings → Providers" and follow the device code authorization guide; no code changes, config files, or environment variables involved.

Known Issues & Limitations

  • Device code authorization depends on OpenAI account settings: Must enable "Enable device code authorization for Codex" on ChatGPT web side before logging in, otherwise OAuth endpoint will refuse to issue device code (README.md:44-46)
  • Shares OAuth session with Codex CLI: After either side refreshes the token, the other side's old refresh_token may become invalid, need to re-login on the invalidated side (README.md:57)
  • Only supports DSH web profile: Client bundle declares platform: "web", CLI/TUI scenarios not covered by this plugin (package.json:57)
  • Device code valid for 15 minutes: Authorization must be completed within 15 minutes of receiving device code, otherwise it expires and login flow must be restarted (lib/index.js:23)
  • Refresh lock wait limit 45 seconds: When multiple DSH processes on the same machine trigger refresh simultaneously, the second process waits max 45 seconds; lock files not released for over 2 minutes are treated as stale locks and automatically recycled (lib/index.js:26-27)
  • Depends on DSH RC version: Currently validated against @deepseek-ai/dsh 0.1.0-rc.6, if DSH adjusts plugin interfaces in the future, this plugin may need synchronized upgrades (README.md:70)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/Hu9956/dsh-codex-provider)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory