Metadata-Version: 2.4
Name: dsh-openai
Version: 0.1.0
Summary: OpenAI-compatible /v1/chat/completions bridge backed by the DeepSeek Harness (dsh) Python SDK.
Author: dsh-openai contributors
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/zjwan461/dsh-openai-compatible
Project-URL: Documentation, https://github.com/zjwan461/dsh-openai-compatible#readme
Project-URL: Issues, https://github.com/zjwan461/dsh-openai-compatible/issues
Project-URL: Repository, https://github.com/zjwan461/dsh-openai-compatible
Keywords: openai,deepseek,agent,harness,bridge,fastapi
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi<0.116,>=0.115
Requires-Dist: uvicorn[standard]<0.33,>=0.32
Requires-Dist: pydantic<3,>=2.9
Requires-Dist: deepseek-harness-sdk>=0.1.5rc1
Requires-Dist: redis<6,>=5
Requires-Dist: fakeredis<3,>=2.23
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: httpx<0.29,>=0.27; extra == "dev"
Dynamic: license-file

# dsh-openai

OpenAI-compatible `/v1/chat/completions` HTTP bridge backed by the **DeepSeek
Harness** Python SDK (`deepseek-harness-sdk`), so any OpenAI client
(OpenWebUI, official SDKs, curl) can drive a full coding agent — tools,
sandbox, persistent shell — instead of a plain chat model. The agent works in
a per-session directory and delivers its files through signed download links.

This directory is both the PyPI packaging root and the Docker build context.
The full deployment documentation (compose, Caddy/TLS, env matrices, security
notes) lives in the [repository README](../README.md).

## Install & run

```bash
pip install dsh-openai                 # or, from a checkout: pip install -e .
set DEEPSEEK_API_KEY=sk-xxxx           # upstream model credential (export on Linux/macOS)
dsh_openai serve                       # -> http://127.0.0.1:8000/v1
```

`python -m dsh_openai serve` is identical. `serve` applies local-development
defaults (loopback bind, `~/.dsh-openai/{home,workspaces}`, in-process
fakeredis, the shipped editor profile patch); precedence is
**CLI flag > `DSH_OPENAI_*` env > local default**. Run
`dsh_openai serve --help` for the flag list.

## Endpoints

- `POST /v1/chat/completions` — JSON and SSE streaming
- `GET /v1/models`, `GET /healthz` (auth-free liveness)
- `GET /v1/dsh/info`, `GET /v1/dsh/sessions/{id}/files`,
  `GET /v1/dsh/files/{token}` (signed deliverable download)

Pin a conversation with the `x-dsh-session-id` header or a stable `chat_id`
body field; both map onto one dsh session and one workspace directory.

## Configuration

All runtime settings are `DSH_OPENAI_*` environment variables resolved by
`dsh_openai/config.py` — including `DSH_OPENAI_API_KEY` (inbound bearer
token), `DSH_OPENAI_MODEL`, `DSH_OPENAI_MAX_SESSIONS`, `DSH_OPENAI_REDIS_URL`,
`DSH_OPENAI_SYSTEM_PROMPT` and `DSH_OPENAI_PATCHES`. Relative patch paths
resolve against the installed package, so the shipped
`dsh_openai/patches/editor.patch.yml` works from any cwd.

## Development

```bash
pip install -e .[dev]
python -m pytest tests
```

## License

Apache-2.0 — see the [LICENSE](LICENSE) file (mirrored from the repository root).
