> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corvex.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect DeepSeek Harness to Token Factory

> Configure Corvex Token Factory as an OpenAI-compatible provider in DeepSeek Harness.

Corvex Token Factory connects to DeepSeek Harness (`dsh`) through an
OpenAI-compatible provider. Add your API key and provider configuration, then
start the Web UI with a Token Factory model.

## Prerequisites

* A Token Factory API key. See [Authentication](/getting-started/authentication).
* [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness#run)
  installed following its official instructions.
* A model from the [Token Factory catalog](/models/overview). This guide uses
  `zai-org/GLM-5.3`.

<Steps>
  <Step title="Set your API key">
    Run these commands in your terminal, replacing `sk-corvex-...` with your
    API key. `DSH_HOME` gives Token Factory its own DSH settings folder.

    ```bash theme={null}
    export CORVEX_API_KEY="sk-corvex-..."
    export DSH_HOME="$HOME/.dsh-corvex"
    mkdir -p "$DSH_HOME"
    chmod 700 "$DSH_HOME"
    ```
  </Step>

  <Step title="Add the provider configuration">
    Create `$DSH_HOME/corvex.patch.yml` with the following contents.
    `apiKeyEnv` tells DSH to read the key you set above.

    ```yaml theme={null}
    - id: llm-pi-ai
      config:
        providers:
          corvex:
            apiKeyEnv: CORVEX_API_KEY
            api: openai-completions
            baseURL: https://api.tokenfactory.corvex.cloud/v1
            compat:
              supportsDeveloperRole: false
              maxTokensField: max_tokens
            models:
              - id: zai-org/GLM-5.3
                contextWindow: 393216
                maxTokens: 393216
                input: [text]
    - id: agent-default-model
      config:
        provider: corvex
        model: zai-org/GLM-5.3
    ```

    If you already configured other providers, keep them in the `providers`
    section when adding this one.
  </Step>

  <Step title="Start the Web UI">
    Open your project directory and start DSH:

    ```bash theme={null}
    cd /path/to/your/project
    dsh --profile web --patch "$DSH_HOME/corvex.patch.yml"
    ```

    DSH opens the Web UI at `http://127.0.0.1:3080`. Start a new session with
    **zai-org/GLM-5.3** selected. Use **Add workspace** to choose another project.

    If you normally start DSH with a different command, use it in place of `dsh`.
    In a new terminal, repeat the commands in step 1 before starting DSH.
  </Step>
</Steps>

To run a single task from the command line instead:

```bash theme={null}
dsh --profile headless --patch "$DSH_HOME/corvex.patch.yml" \
  "Explain the structure of this project."
```

## Token limits

The conversation, reasoning and answer share the model's token limit. The
configuration sets `contextWindow` and `maxTokens` to `393216`; DSH leaves room
for the conversation when deciding how many tokens the model can generate.
A smaller `maxTokens` value can stop the model before it finishes reasoning.

## If a request fails

DSH automatically summarizes older messages to make room and retries when a
request exceeds the context limit. You do not need to edit the conversation.

A `429` error means requests are temporarily limited. This can follow heavy
usage or repeated failures. If the response includes `Retry-After`, wait that
long before trying again. Waiting alone will not fix a request that keeps failing.

If DSH cannot continue, contact
[Token Factory support](/reference/faq#how-do-i-contact-support) with the error
message and request ID, if available. See [Errors](/reference/errors) for details.
