The Chinese neural network DeepSeek has recently gained popularity. Today, we'll figure out how to work with its API, how to pay for it from Russia, and how to use it in applications.

A ready-made code example is available at this link.

Why use DeepSeek and what are its advantages?

If you follow me, you'll know I've already covered GigaChatApi, and I haven't had to do a breakdown of the OpenAI API because it's inconvenient and has already been covered in many places. But DeepSeek has its own advantages.

  • Access without a VPN. DeepSeek is available in Russia without a VPN and works stably.

  • Payment is available, but with some nuances. However, it's cheaper than ChatGPT and even GigaChat MAX, but comparable to GigaChat Lite.

  • Compared to ChatGPT, it performs on par. GigaChat, however, loses to both, although I haven't personally tested or read anything about GigaChat MAX.

Registering on the DeepSeek API Platform and getting a key

On the official website, you can find a button to open a regular chat, but we need to go to the API interface:

Here we need the "Sign Up" button. Enter your email, create a password, and enter the code that will be sent to your email:

Basically, you're all set. Next, we need the docs. After reading them, we can draw some simple conclusions:

  • DeepSeek uses the openai library for Python

  • Overall, the logic is very similar to working with other neural networks

Here's a breakdown of an API request:

from openai import OpenAI

client = OpenAI(api_key="", base_url="https://api.deepseek.com")

response = client.chat.completions.create(
    model="deepseek-chat", #определение модели
    messages=[
        {"role": "system", "content": "You are a helpful assistant"}, #описание роли самой нейронки
        {"role": "user", "content": "Hello"}, #сообщение от юзера
    ],
    stream=False #если True - делит ответ на куски для постепенного отображения
)

print(response.choices[0].message.content)

If you want, you can add more messages - this will allow the chatbot to respond in context.

Essentially, all you need for a request is an API key.

It's very easy and quick:

After this, we need to pay for access by making a deposit for tokens. And this is where the difficulties begin.

Payment from Russia

It's complicated. You can pay for access with a card in yuan or dollars, but as we know, the latter are not available in Russia.

Even UnionPay cards in yuan (I have both Rosselkhozbank and Gazprombank) couldn't be linked. This leaves us with two options: payment in yuan via WeChatPay or AliPay.

I chose AliPay; registering with a Russian phone number was no problem. I followed the steps in this article. You'll need an international passport (I had to scan its chip using NFC, so it's better to have an Android). However, UnionPay cards still don't connect or work. So, you'll have to go to Avito and look for kind people with good reviews.

Once you have the money, go to the payment section, select yuan and Alipay:

When you press the button, a QR code for payment will be generated. Scan it in the Alipay app and confirm the payment with your code.

The API will start working immediately, and you can use it with your key.

Prices in the table:

MODEL(1)

deepseek-chat

MAX COT TOKENS(2)

-

MAX OUTPUT TOKENS(3)

8K

STANDARD PRICE(UTC 00:30-16:30)

1M TOKENS INPUT (CACHE HIT)(4)

$0.07

1M TOKENS INPUT (CACHE MISS)

$0.27

1M TOKENS OUTPUT(5)

$1.10

DISCOUNT PRICE(6)(UTC 16:30-00:30)

1M TOKENS INPUT (CACHE HIT)

$0.035(50% OFF)

1M TOKENS INPUT (CACHE MISS)

$0.135(50% OFF)

1M TOKENS OUTPUT

$0.550(50% OFF)

Conclusions

  • DeepSeek is a good alternative to GigaChat in Russia.

  • Responds slightly slower

  • Slightly smarter

  • Costs less

  • Difficulties with payment

  • Simple API

And I don't want to work with OpenAI (constantly switching VPNs), so I only use it when necessary. In my daily work, I've replaced it with other neural networks.

Repository with the results.