Back to blog

Tools & integrationsGuide

Connect DeepSeek Harness to CheapTokens: custom provider

Add a custom OpenAI-compatible provider in DeepSeek Harness, point it at the CheapTokens API and run a first coding task. Plus what to check if it fails.

By CheapTokens TeamPublished 6 min read

Cover: DeepSeek Harness connected to CheapTokens through a custom provider
On this page
  1. What you are connecting
  2. Check the key before you open Harness
  3. Fill in the custom provider form
  4. Pick the model and run a first task
  5. Why a cheap model fits an agent loop
  6. If it does not work
  7. Before you close the tab

To use DeepSeek Harness with CheapTokens, open Settings → Models, switch the card to Custom model API, set the base URL to https://api.cheaptokens.dev/v1, pick OpenAI Chat Completions as the protocol, paste your CheapTokens key and add the model id deepseek-ai/DeepSeek-V4-Flash-0731. Select that model in the picker and your next session runs on it.

That is the whole trick. The rest of this page is the exact form, a quick check that the key works before you blame the app, and a short list of what to look at when the gateway says no.

The settings below come from the Harness docs as of 24 October 2026. The project is in public preview, and its README warns that compatibility-breaking changes will happen, so if a label has moved, trust the screen and the provider guide.

What you are connecting#

DeepSeek Harness is an open-source agent from DeepSeek (MIT license, built on the Cordis plugin architecture). It comes as a desktop app for macOS on Apple silicon and Windows 64-bit, or as a web UI you start with npx @deepseek-ai/dsh web (Node.js required). The web UI opens at http://127.0.0.1:3080 by default.

Out of the box it asks for a DeepSeek key. But the same Models screen has a card for anything that is not in its catalog, a relay, a company gateway or another provider. That card is what we use.

On the CheapTokens side you need two things: a key and a balance. If you have not made a key yet, Your first API request with CheapTokens takes a couple of minutes, and What is an API key and how to store it safely covers where to keep it.

Check the key before you open Harness#

One request from the terminal tells you whether the key, the balance and the model id are fine. If this works and Harness does not, the problem is in the form, not in the account.

bash
curl https://api.cheaptokens.dev/v1/chat/completions \
  -H "Authorization: Bearer $CHEAPTOKENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V4-Flash-0731",
    "messages": [{"role": "user", "content": "Say hi in five words."}]
  }'

You should get a JSON answer with a choices array and a usage block that counts the input and output tokens. An Invalid API key style error means the key; a message about the balance means a top-up is due.

Fill in the custom provider form#

Open Settings → Models and switch the provider card to Custom model API. Fill the fields like this:

Field What to enter
Provider ID cheaptokens (lowercase; it cannot be changed later, so pick a name you like)
Display name CheapTokens
Base URL https://api.cheaptokens.dev/v1
API protocol OpenAI Chat Completions
Credential your CheapTokens API key
Models deepseek-ai/DeepSeek-V4-Flash-0731

Two details trip people up. First, the base URL is https://api.cheaptokens.dev/v1, exactly as in the curl above minus /chat/completions. Second, the model id is the full one with the deepseek-ai/ prefix. A short name like deepseek-v4-flash is not what the API expects. If you want the background on base_url and how to switch it, see OpenAI-compatible API: what base_url is and how to switch.

There is also a Fetch available models button. The docs say it queries GET /models and that you can always type the id by hand. Typing it is the safe path here, so do that.

Custom model API card in DeepSeek Harness: empty form turns into the filled CheapTokens provider
Illustration: the Custom model API card before and after filling it in

Pick the model and run a first task#

Open the model picker and choose the CheapTokens model. Picking a model there makes it the default for new sessions, so you do not have to repeat it.

Now give it something small and checkable. Say you have a project with a failing test:

text
Run the tests, find why test_parse_date fails and fix it. Show me the diff.

What you want to see: the agent runs the test command, reads the failing file, edits it, runs the tests again and shows a diff. If it does that, the connection is done. Your balance is now what pays for the loop.

Why a cheap model fits an agent loop#

An agent does not send one question. It sends the whole conversation, the file listings and the tool output again at every step, so a session is mostly input tokens. That is what makes agent bills surprising (why a long chat costs more explains the mechanics, and How to estimate the cost of an AI agent gives the method).

Say a session has 200 steps, each step sends about 30,000 tokens of context and gets about 600 tokens back. That is 200 × 30,000 = 6,000,000 input tokens and 200 × 600 = 120,000 output tokens. On DeepSeek-V4-Flash that session costs $0.102 at today's prices, and it is cheaper than OpenRouter in total, with input and output counted together. The table below uses the same workload for every model we offer:

Model Cost OpenRouter
GLM-5.3-Flash $0.125 $0.257
DeepSeek-V4-Flash $0.102 $0.304
MiniMax-M2.7 $0.318 $1.94

6,000,000 input and 120,000 output tokens in total. Prices per 1M tokens are current and change together with our tariffs; the OpenRouter column shows reference prices for the same workload.

For long sessions DeepSeek-V4-Flash gives you a 380K context window, up to 32,768 tokens in one answer, and one price at any hour: no peak-hour surcharge. It uses the same balance as every other CheapTokens model, so you can switch models in Harness without topping up again. Current rates are on the pricing page, and the model page has more on the DeepSeek line.

Prefer to keep the session lighter? Add zai-org/GLM-5.3-Flash (390K context, up to 8,192 output tokens) or MiniMaxAI/MiniMax-M2.7 (180K context, up to 8,192 output tokens) to the same provider as extra model ids. One provider can hold several models, and the picker lets you move between them.

If it does not work#

The Harness docs list the usual suspects. Here they are with what to do:

  • The gateway refuses every request although the key and URL are right. The request shape differs from what the endpoint expects. Harness has per-model compatibility settings, such as the role used for the system prompt or the name of the output-token field. They live in $DSH_HOME/profiles/<profile>/cordis.patch.yml and reload without a restart. Take the exact keys from the provider guide rather than guessing them.
  • The effort menu is missing for the model you typed in. Harness shows reasoning levels only for models that declare them. A hand-entered model has none declared, so the menu stays empty. Declaring levels is part of the same per-model settings file.
  • 401 when fetching models. Check the key, or skip the button and enter the model id yourself.
  • An answer stops mid-sentence. That is a token limit, not a broken connection; see why an AI answer stops mid-sentence.
  • A 401 or 403 in the log from the first request. Repeat the curl check above with the same key. If curl works, retype the key in the Credential field; a stray space at the end is a classic.

If you already use another agent with the same key, connecting OpenCode follows the same pattern, and the CheapTokens docs list every endpoint. One more tool in the same drawer, one balance.

Before you close the tab#

  • Base URL: https://api.cheaptokens.dev/v1
  • Protocol: OpenAI Chat Completions
  • Model id: deepseek-ai/DeepSeek-V4-Flash-0731
  • Key: from your CheapTokens account, kept out of screenshots and repos

Run the failing-test task once and watch the usage on your balance. That one run tells you what your own sessions cost.