Back to blog

Getting startedGuide

How to pay for the DeepSeek API: top up and first call

Top up a prepaid balance, create a key and send your first DeepSeek-V4-Flash request in a few minutes.

By CheapTokens TeamPublished Updated 3 min read

Cover: how to pay for the DeepSeek API and send the first request
On this page
  1. How it works
  2. Step 1. Top up the balance
  3. Step 2. Create an API key
  4. Step 3. Send the first request
  5. What the request costs
  6. Which DeepSeek name to use
  7. Common problems
  8. Next steps

Paying for an AI API is simpler than it sounds: you top up a prepaid balance, create a key, and every request spends from that balance. This guide walks through it for DeepSeek-V4-Flash on CheapTokens, from the top-up to a working request.

By the end you will have a funded balance, a key and a request that returns an answer.

How it works#

CheapTokens is pay as you go. You put money on a USD balance, and each request deducts the cost of the tokens it used. There is no subscription, and one balance covers all models. Prices per model are fixed, with no peak-hour or time-of-day pricing.

The model in this guide is DeepSeek-V4-Flash, release 0731 (id deepseek-ai/DeepSeek-V4-Flash-0731). It has a 380K context window and can return up to 32,768 tokens in one answer.

For a first test, a small top-up is plenty: a short request costs a tiny fraction of a cent, as the numbers below show.

Step 1. Top up the balance#

  1. Sign in to your CheapTokens account.
  2. Open the balance top-up section and enter the amount.
  3. Complete the payment on the checkout page.
  4. Wait until the new balance appears in your account.

If a request later fails with a balance error, see "Not enough tokens" error: what it means and how to fix it.

Step 2. Create an API key#

Create a key in your account and copy it right away. Treat it like a password: keep it in an environment variable, not in code or a public repository. The article What is an API key and how to store it safely explains how.

bash
export CHEAPTOKENS_API_KEY="paste-your-key-here"

Step 3. Send the first request#

The API is compatible with OpenAI Chat Completions (and with Anthropic Messages), so most clients work by changing the base URL: https://api.cheaptokens.dev/v1.

With curl:

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 hello in one sentence."}],
    "max_tokens": 100
  }'

With the official OpenAI Python library:

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.cheaptokens.dev/v1",
    api_key=os.environ["CHEAPTOKENS_API_KEY"],
)

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Flash-0731",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=100,
)
print(response.choices[0].message.content)

If you get a text answer, payment, key and connection all work. For a more detailed first call, see Your first API request with CheapTokens, and for long answers and streaming, DeepSeek-V4-Flash API quickstart.

What the request costs#

You pay for input tokens (what you send) and output tokens (what the model writes). Current MiniMax-M2.7 prices per 1M tokens: input $0.05, output $0.15.

A test request with about 300 input and 200 output tokens costs $0.000045. So even the smallest top-up covers a very large number of experiments.

In total, with input and output counted together, MiniMax-M2.7 on CheapTokens is cheaper than OpenRouter. For a live comparison, see the DeepSeek API pricing article.

Which DeepSeek name to use#

Use the id deepseek-ai/DeepSeek-V4-Flash-0731 exactly as written above. Model names differ between providers, so copy ids from the CheapTokens docs rather than from another service.

Common problems#

  • Authentication error. Check that the key is copied in full and the environment variable is set in the same terminal.
  • Balance error. The top-up has not arrived yet or the balance is empty. Wait for the payment to confirm, then retry.
  • Connection error. Check the base URL ends with /v1. More in Common connection errors and how to fix them.

Next steps#

You now have a funded balance and a working call. Use the same key and base URL in any OpenAI-compatible tool, and keep one balance for all models.

Endpoints, model ids and limits for every model are in the CheapTokens docs.