Skip to content
dsh.fish
Bundle

dsh-codex-adapter

ChatGPT-powered coding, image generation and web search for DeepSeek Harness, with account and usage settings.

Source
baixianger
License
MIT
Updated
Updated yesterday

Readme

<div align="center">

<img src="docs/assets/hero.svg" alt="DSH Codex Adapter" width="100%" />

# DSH Codex Adapter

[English](README.md) · [简体中文](README.zh.md)

[![npm](https://img.shields.io/npm/v/dsh-codex-adapter?style=flat-square&color=374151)](https://www.npmjs.com/package/dsh-codex-adapter) [![License: MIT](https://img.shields.io/badge/License-MIT-374151?style=flat-square)](LICENSE) [![DSH plugin](https://img.shields.io/badge/DSH-plugin-374151?style=flat-square)](https://github.com/topics/dsh-plugin)

</div>

Use your ChatGPT account in DeepSeek Harness for coding conversations, image generation, and web search. Sign in from DSH, check your usage, and manage these capabilities in one settings page.

[Quick start](#quick-start) · [Image generation](#image-generation) · [Settings](#settings) · [Configuration](docs/configuration.md)

## See it in action

<img src="docs/assets/image-generation-demo.png" alt="A real DSH conversation generating a watercolor cat, saving the PNG, and showing a download button and successful reply" width="760" />

*An actual run: a 1254 × 1254 PNG, saved to the workspace, available to download, followed by a normal assistant reply. The screenshot shows the Chinese DSH interface; the settings and image card support English too.*

## What you get

| Capability | In DSH |
| --- | --- |
| **Coding conversations** | The `openai-codex` model route, including streamed replies and image context. |
| **Account & usage** | ChatGPT sign-in, CLI login import, cancellation, sign-out, plan and usage windows when available. |
| **Image generation** | The `imagegen` tool, inline preview, dimensions, download, and workspace save status. |
| **Reference images** | Edit using workspace images or recent image attachments. |
| **Web search** | A Codex search provider with cached, indexed, and live modes. |
| **Native settings** | A full Codex page and a compact Plugins card, with light/dark themes and English/Chinese labels. |

## Quick start

Requires a current DSH installation with the 0.1.5 adapter interfaces and Node.js 22.19+ or 24+.

```bash
dsh plugin --profile web add dsh-codex-adapter@latest
dsh web
```

1. Open **Settings → Codex** and sign in with ChatGPT, or import your existing Codex CLI login.
2. Choose a model under **Codex** in the conversation model picker.
3. Start a conversation, or ask for an image.

If `dsh-codex` is already installed, remove it before adding this adapter: both own the same `openai-codex` route.

```bash
dsh plugin --profile web remove dsh-codex
```

## Image generation

Try this in a conversation:

> Generate one watercolor illustration of an orange cat by a sunny window, with a small green plant and no text. Save it as window-cat.png.

The image card shows the result, its dimensions and size, a download button, and the workspace save status. DSH may collapse completed tool calls; expand the tool group to see the image again.

For image editing, provide `referenced_image_paths` or `num_last_images_to_include` to `imagegen`. Use one reference method per call, with up to five images.

Generated images are durable attachments, so the conversation can continue with image context. Local saves respect workspace access, cancellation, and observed-file protection. A remote filesystem must provide binary writing to support workspace saves; otherwise the image remains available as an attachment and download.

## Settings

- **Account:** browser or device sign-in, manual callback fallback, cancel, CLI import, and sign-out. Login attempts expire after ten minutes.
- **Usage:** plan, remaining allowances, reset times, and credits when returned by the service. Missing data stays unknown; an unavailable usage request does not sign you out.
- **Capabilities:** image generation/editing, web search, and search mode. Saved changes apply to subsequent requests.

## Web search

Enable web search in **Settings → Codex**. If several search providers are available, select Codex explicitly in your profile patch:

```yaml
# ~/.dsh/profiles/web/cordis.patch.yml
- id: web
  config:
    searchProvider: openai-codex
    fetchProvider: http
```

The setting `DSH_WEB_SEARCH_PROVIDER=openai-codex` is another way to select the provider. This plugin supplies search; DSH's configured fetch provider still owns page fetching.

## Credentials & compatibility

Sign-in state uses DSH's credential service. A standalone CLI document can seed an empty record; refreshes then use the shared credential writer. Sign-out clears both so an older file cannot silently sign you back in.

```bash
dsh plugin --profile web exec dsh-codex-adapter status
dsh plugin --profile web exec dsh-codex-adapter import
```

`status` prints account metadata, never tokens. The CLI also supports `login`, `logout`, and an optional import path. See [configuration and authorization](docs/configuration.md) for storage locations and advanced settings.

The adapter follows the installed `PiAiAdapter` contract, including model errors and attachment resolution. It does not implement the other bundle's fast mode, native compaction, or `/codex` terminal command.

## Implementation & acknowledgements

Authentication is built on [pi-ai](https://github.com/earendil-works/pi/tree/main/packages/ai)'s `openaiCodexProvider`, with authentication flow and settings UI references from [Yan-Zero/dsh-codex](https://github.com/Yan-Zero/dsh-codex). At runtime, pi-ai provides model communication, OAuth sign-in, and credential refresh; DSH's `PiAiAdapter` connects the provider to the harness.

**Image generation/editing and ChatGPT's built-in web-search integration are implemented by this project.** The adapter directly calls the ChatGPT Codex backend's image and search endpoints, reuses the credentials managed by pi-ai, and integrates the results with DSH's tools, attachments, and search service. The provider's image-input capability lets conversation models receive images; image generation uses this adapter's separate `imagegen` client.

The local binary-write compatibility code used to save generated images is adapted from dsh-codex 0.2.9 and retains its [Apache-2.0 license](lib/licenses/dsh-codex-Apache-2.0.txt). The remainder of this package is MIT licensed.

## Automated releases

Tagged releases use [GitHub Actions](.github/workflows/release.yml) and npm Trusted Publishing. Push `v<package.json version>` to run a clean install, the full checks, and publication to `latest`. The workflow rejects mismatched tags, leaves existing immutable versions intact, and uses GitHub OIDC instead of a stored npm publish token.

The first npm version is bootstrapped interactively; subsequent versions use the package's trust binding to `baixianger/dsh-codex-adapter` and `release.yml`.

## Development & feedback

```bash
npm ci
npm run check
```

[Report an issue](https://github.com/baixianger/dsh-codex-adapter/issues) · [Release notes](RELEASES.md) · [MIT license](LICENSE)

Install

dsh plugin --profile web add github:baixianger/dsh-codex-adapter

Profile: web

  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source