Skip to main content

Responses API to Chat Completions proxy for Codex-compatible model providers.

Project description

ds4codex

ds4codex is a small local proxy that lets Codex use DeepSeek models through a Responses-to-Chat translation layer.

The current shape is intentionally simple:

  • only one human-edited config file: ~/.codex/config.toml
  • one generated file for /model: ~/.codex/ds4codex-model-catalog.json
  • only two CLI commands: init and run

Install

cd /Volumes/data/github/seqyuan/ds4codex
pip install .

or:

pipx install .

Commands

Initialize Codex config and model catalog:

ds4codex init --apikey sk-your-deepseek-api-key

init will try to reuse Codex's bundled model schema when codex is available, but it no longer requires a working local codex executable.

Start the proxy:

ds4codex run

What init Writes

ds4codex init updates ~/.codex/config.toml and generates:

~/.codex/ds4codex-model-catalog.json

It writes three managed blocks into ~/.codex/config.toml:

# BEGIN DS4CODEX ROOT
model = "deepseek-v4-flash"
model_provider = "ds4codex"
model_context_window = 1048576
model_catalog_json = "/home/you/.codex/ds4codex-model-catalog.json"
# END DS4CODEX ROOT

# BEGIN DS4CODEX SETTINGS
[ds4codex]
port = 8099
target_url = "https://api.deepseek.com/v1/chat/completions"
thinking = "disabled"
# END DS4CODEX SETTINGS

# BEGIN DS4CODEX PROVIDER
[model_providers.ds4codex]
name = "DeepSeek via ds4codex"
base_url = "http://127.0.0.1:8099/v1"
wire_api = "responses"
experimental_bearer_token = "sk-your-deepseek-api-key"
# END DS4CODEX PROVIDER

Where Settings Live

The proxy now reads its local runtime settings from:

[ds4codex]
port = 8099
target_url = "https://api.deepseek.com/v1/chat/completions"
thinking = "disabled"

That means ~/.config/ds4codex/config.toml is no longer needed.

thinking is only the default when Codex does not send an explicit reasoning level.

Accepted practical values are:

  • disabled
  • enabled
  • high
  • max

Compatibility mapping is applied for Codex-style reasoning levels:

  • low, medium, minimal -> high
  • xhigh -> max

Why the Proxy Is Still Required

Moving settings into ~/.codex/config.toml makes configuration cleaner, but it does not remove the need for the server itself.

Codex custom providers send:

  • wire_api = "responses"

DeepSeek currently documents:

  • chat.completions

So the proxy is still the protocol adapter between Codex Responses requests and DeepSeek Chat Completions requests.

/model Support

ds4codex init generates a model catalog JSON and points Codex at it through model_catalog_json.

This is a file, not a directory. Its only purpose is to make Codex's /model menu aware of the custom DeepSeek entries exposed through ds4codex.

That makes /model show:

  • DeepSeek V4 Flash
  • DeepSeek V4 Pro

and the catalog advertises these reasoning levels:

  • low
  • medium
  • high
  • xhigh

The proxy maps those levels to DeepSeek-compatible request fields before forwarding upstream.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds4codex-0.1.2.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ds4codex-0.1.2-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file ds4codex-0.1.2.tar.gz.

File metadata

  • Download URL: ds4codex-0.1.2.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ds4codex-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16e9cbbe8078e497699c8e4c847c48ac4c361d96a69be2d53151fe2d623a0ebe
MD5 17dcec8691416707128802274903c197
BLAKE2b-256 65662a9302fafefc959c923e21232f448f26e52e13451825781d2ac649fbba68

See more details on using hashes here.

File details

Details for the file ds4codex-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ds4codex-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ds4codex-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6094324a0755d885c6d0578a6cb6d500538a24fbe07753a8078869e08eabe10
MD5 66c14991679e8e565e20527336941654
BLAKE2b-256 847d7ece57470dc7a51772232f46e02aa1ffcac09d62fb1b6dcbca5aa8838623

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page