DeepSeek Harness

Connect DeepSeek Harness (dsh) to OpenGateway with a custom OpenAI Chat Completions provider in a dedicated profile, leaving shipped profiles untouched.

Copy this to your agent
Paste it into any AI agent. It sets up the npx @deepseek-ai/dsh --profile opengateway profile and saves it as the opengateway-deepseek-harness skill.

Apply a one-off patch#

The --patch option adds an overlay for one launch; it does not write the settings into the selected profile. The YAML file remains in your project. Set OPENGATEWAY_API_KEY in your shell first, and keep the secret out of the patch file.

Bash
cat > opengateway.patch.yml <<'YAML'
- id: llm-pi-ai
config:
providers:
opengateway:
displayName: OpenGateway
apiKeyEnv: OPENGATEWAY_API_KEY
api: openai-completions
baseURL: "https://apis.opengateway.ai/v1"
models:
- id: deepseek/deepseek-v4.1-flash-ultrafast
name: DeepSeek V4.1 Flash UltraFast
- id: z-ai/glm-5.3-flash-ultrafast
name: GLM-5.3 Flash UltraFast
- id: agent-default-model
config:
provider: opengateway
model: deepseek/deepseek-v4.1-flash-ultrafast
YAML
npx @deepseek-ai/dsh --profile headless --patch ./opengateway.patch.yml "Reply with OK"

Set it up by hand#

1. Get an API key#

OpenGateway → API Keys → Create Key. Export the key in the shell that will start DeepSeek Harness; add it to ~/.zshrc or ~/.bashrc only if you want it available in new shells:

Bash
export OPENGATEWAY_API_KEY="YOUR_OPENGATEWAY_API_KEY"

2. Create a profile#

Use a separate profile so your other profiles remain unchanged. The command below creates opengateway from the shipped headless template and prints the composed configuration without starting the app:

Bash
npx @deepseek-ai/dsh --profile opengateway --from-default-profile headless --dump-config

--from-default-profile replaces an existing custom profile. If $DSH_HOME/profiles/opengateway already exists, do not run that command; inspect and preserve the existing profile instead. DSH_HOME defaults to ~/.dsh. To use the Web UI, create the profile from web rather than headless.

3. Add the provider#

Edit ~/.dsh/profiles/opengateway/cordis.patch.yml (or $DSH_HOME/profiles/opengateway/cordis.patch.yml when DSH_HOME is set):

YAML
- id: llm-pi-ai
config:
providers:
opengateway:
displayName: OpenGateway
apiKeyEnv: OPENGATEWAY_API_KEY
api: openai-completions
baseURL: "https://apis.opengateway.ai/v1"
models:
- id: deepseek/deepseek-v4.1-flash-ultrafast
name: DeepSeek V4.1 Flash UltraFast
- id: z-ai/glm-5.3-flash-ultrafast
name: GLM-5.3 Flash UltraFast
- id: agent-default-model
config:
provider: opengateway
model: deepseek/deepseek-v4.1-flash-ultrafast

api: openai-completions selects OpenAI Chat Completions, and the base URL ends in /v1. apiKeyEnv names the environment variable; it never contains the key itself. The models list defines the models offered for this provider, and agent-default-model selects the default. Both IDs above are OpenGateway UltraFast models. Each has a per-key limit on concurrent in-flight requests; excess requests return 429 with concurrency_limit_exceeded and Retry-After. Reduce parallel requests or wait before retrying, or contact support to request a higher limit. For either model, requests with more than 256K input tokens have double the input-token price for the whole request; cache reads and output tokens are not surcharged. See UltraFast and /models for the current rules and pricing.

A cordis.patch.yml entry targeting llm-pi-ai replaces that row's entire config. If the profile already has other llm-pi-ai providers or settings, preserve them under config when adding opengateway.

4. Verify#

First inspect the resolved configuration without making a model request:

Bash
dsh --profile opengateway --dump-config

If the dsh command is not on your path, use npx @deepseek-ai/dsh --profile opengateway --dump-config instead. Confirm that the provider route and default model match the YAML. For a profile created from headless, then run:

Bash
npx @deepseek-ai/dsh --profile opengateway "Reply with OK"

For a profile created from web, start it with npx @deepseek-ai/dsh --profile opengateway and send a test prompt in the UI. A response confirms the connection; usage appears on the dashboard.

To undo the setup, remove only the OpenGateway provider and default-model rows you added. Remove the shell export only if another setup does not use that key.

DeepSeek Harness — OpenGateway