Skip to content
Docs

DeepSeek Harness with AI Gateway

DeepSeek Harness (dsh) is DeepSeek's terminal coding agent, built on the pi-ai LLM layer. You can configure it to use AI Gateway for unified model access and spend monitoring, while keeping its native model picker.

Run the Vercel CLI setup command for DeepSeek Harness:

terminal
npx vercel ai-gateway setup --agent deepseek

The command writes an llm-pi-ai section to $DSH_HOME/settings.yaml naming AI_GATEWAY_API_KEY as the key environment variable, plus a model shortlist that leads with the newest DeepSeek models and follows with the gateway's most-used models. Re-run it to refresh the shortlist.

If you can't use the Vercel CLI, configure DeepSeek Harness manually:

  1. Go to the AI Gateway section in the Vercel dashboard sidebar and click API keys to create a new API key.

  2. Export the key in your shell:

    Terminal
    export AI_GATEWAY_API_KEY="your-ai-gateway-api-key"

    To persist the key, add the same line to your shell's startup file.

  3. Add the gateway provider to the llm-pi-ai section of $DSH_HOME/settings.yaml (default ~/.dsh/settings.yaml):

    ~/.dsh/settings.yaml
    llm-pi-ai:
      providers:
        vercel-ai-gateway:
          apiKeyEnv: AI_GATEWAY_API_KEY
          models:
            - id: deepseek/deepseek-v4-flash
              name: DeepSeek V4 Flash
            - id: openai/gpt-6-astra
              name: GPT-6 Astra
     
    agent-default-model:
      provider: vercel-ai-gateway
      model: deepseek/deepseek-v4-flash

    The shortlist under models drives the picker. Replace pi-ai's full catalog with the gateway models you want, and add any gateway model ID to it. agent-default-model picks the model DeepSeek Harness starts with.

  4. Open a new terminal so the key is loaded, then run:

    Terminal
    dsh

    Headless runs use the gateway route too. Switch models with /model in a session.

View your usage, spend, and request activity in the AI Gateway section in the Vercel dashboard sidebar. See the observability documentation for more details.

VariableDescription
AI_GATEWAY_API_KEYYour AI Gateway API key, named by apiKeyEnv. Required
DSH_HOMEOverrides the harness home directory. Defaults to ~/.dsh

DeepSeek Harness calls AI Gateway through the OpenAI-compatible Chat Completions API, so any model that supports Chat Completions works.

Last updated September 13, 2026

Was this helpful?

supported.